Spaces:
Running
Running
Fix cache issues w a 'tmp' directory
Browse files
app.py
CHANGED
@@ -1,9 +1,13 @@
|
|
1 |
import os
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
-
os.environ["
|
6 |
-
os.environ["
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# Ensure the directory exists
|
9 |
os.makedirs("/data/.cache", exist_ok=True)
|
|
|
1 |
import os
|
2 |
|
3 |
+
# Set Hugging Face and Torch cache to a guaranteed-writable location
|
4 |
+
cache_dir = "/tmp/huggingface_cache"
|
5 |
+
os.environ["TRANSFORMERS_CACHE"] = cache_dir
|
6 |
+
os.environ["HF_HOME"] = cache_dir
|
7 |
+
os.environ["TORCH_HOME"] = cache_dir
|
8 |
+
|
9 |
+
# Create the directory if it doesn't exist
|
10 |
+
os.makedirs(cache_dir, exist_ok=True)
|
11 |
|
12 |
# Ensure the directory exists
|
13 |
os.makedirs("/data/.cache", exist_ok=True)
|