This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user