This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "discours-core"
|
||||
version = "0.9.14"
|
||||
version = "0.9.18"
|
||||
description = "Core backend for Discours.io platform"
|
||||
authors = [
|
||||
{name = "Tony Rewin", email = "tonyrewin@yandex.ru"}
|
||||
|
||||
@@ -15,17 +15,21 @@ def get_models_cache_dir() -> str:
|
||||
"""Определяет лучшую папку для кеша моделей"""
|
||||
# Пробуем /dump если доступен для записи
|
||||
dump_path = Path("/dump")
|
||||
print(f"🔍 Checking /dump - exists: {dump_path.exists()}, writable: {os.access('/dump', os.W_OK) if dump_path.exists() else 'N/A'}")
|
||||
|
||||
if dump_path.exists() and os.access("/dump", os.W_OK):
|
||||
cache_dir = "/dump/huggingface"
|
||||
try:
|
||||
Path(cache_dir).mkdir(parents=True, exist_ok=True)
|
||||
print(f"✅ Using mounted storage: {cache_dir}")
|
||||
return cache_dir
|
||||
except Exception: # noqa: S110
|
||||
pass
|
||||
except Exception as e:
|
||||
print(f"❌ Failed to create {cache_dir}: {e}")
|
||||
|
||||
# Fallback - локальная папка ./dump
|
||||
cache_dir = "./dump/huggingface"
|
||||
Path(cache_dir).mkdir(parents=True, exist_ok=True)
|
||||
print(f"📁 Using local fallback: {cache_dir}")
|
||||
return cache_dir
|
||||
|
||||
|
||||
|
||||
@@ -22,17 +22,21 @@ def get_models_cache_dir() -> str:
|
||||
"""Определяет лучшую папку для кеша моделей"""
|
||||
# Пробуем /dump если доступен для записи
|
||||
dump_path = Path("/dump")
|
||||
logger.info(f"🔍 Checking /dump - exists: {dump_path.exists()}, writable: {os.access('/dump', os.W_OK) if dump_path.exists() else 'N/A'}")
|
||||
|
||||
if dump_path.exists() and os.access("/dump", os.W_OK):
|
||||
cache_dir = "/dump/huggingface"
|
||||
try:
|
||||
Path(cache_dir).mkdir(parents=True, exist_ok=True)
|
||||
logger.info(f"✅ Using mounted storage: {cache_dir}")
|
||||
return cache_dir
|
||||
except Exception: # noqa: S110
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to create {cache_dir}: {e}")
|
||||
|
||||
# Fallback - локальная папка ./dump
|
||||
cache_dir = "./dump/huggingface"
|
||||
Path(cache_dir).mkdir(parents=True, exist_ok=True)
|
||||
logger.info(f"📁 Using local fallback: {cache_dir}")
|
||||
return cache_dir
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user