Spaces:
Sleeping
Sleeping
glitz-dev
commited on
Commit
·
b3ad8fa
1
Parent(s):
3b3e0b9
avoided the deprecated TRANSFORMERS_CACHE from hipaathesis
Browse files- hipaathesis.py +8 -15
hipaathesis.py
CHANGED
|
@@ -8,22 +8,15 @@ def setup_cache_directories():
|
|
| 8 |
"""Setup cache directories for transformers and torch with proper permissions"""
|
| 9 |
try:
|
| 10 |
# Create cache directories in /app with proper permissions
|
| 11 |
-
cache_dirs =
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
'/root/.cache/torch'
|
| 16 |
-
]
|
| 17 |
-
|
| 18 |
-
for cache_dir in cache_dirs:
|
| 19 |
-
os.makedirs(cache_dir, exist_ok=True)
|
| 20 |
-
# Set permissions to be writable
|
| 21 |
-
os.chmod(cache_dir, 0o777)
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
|
| 28 |
print(f"Cache directories setup complete: {cache_dirs}")
|
| 29 |
|
|
|
|
| 8 |
"""Setup cache directories for transformers and torch with proper permissions"""
|
| 9 |
try:
|
| 10 |
# Create cache directories in /app with proper permissions
|
| 11 |
+
cache_dirs = {
|
| 12 |
+
'HF_HOME': '/app/.cache/huggingface',
|
| 13 |
+
'TORCH_HOME': '/app/.cache/torch'
|
| 14 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
for env_var, path in cache_dirs.items():
|
| 17 |
+
os.makedirs(path, exist_ok=True)
|
| 18 |
+
os.chmod(path, 0o777)
|
| 19 |
+
os.environ[env_var] = path
|
| 20 |
|
| 21 |
print(f"Cache directories setup complete: {cache_dirs}")
|
| 22 |
|