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