Spaces:
Running
on
Zero
Running
on
Zero
Use persistent /workspace for checkpoint cache if available
Browse files
app.py
CHANGED
|
@@ -49,10 +49,14 @@ def get_checkpoint_path(checkpoint_file, default_local_path, repo_id=None, filen
|
|
| 49 |
if repo_id and filename and HF_HUB_AVAILABLE:
|
| 50 |
try:
|
| 51 |
print(f"📥 Downloading checkpoint from {repo_id}...")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
checkpoint_path = hf_hub_download(
|
| 53 |
repo_id=repo_id,
|
| 54 |
filename=filename,
|
| 55 |
-
cache_dir=
|
| 56 |
local_files_only=False
|
| 57 |
)
|
| 58 |
print(f"✅ Checkpoint downloaded to: {checkpoint_path}")
|
|
|
|
| 49 |
if repo_id and filename and HF_HUB_AVAILABLE:
|
| 50 |
try:
|
| 51 |
print(f"📥 Downloading checkpoint from {repo_id}...")
|
| 52 |
+
# Use /workspace if available (persistent), otherwise /tmp
|
| 53 |
+
cache_dir = "/workspace/checkpoints" if os.path.exists("/workspace") else "/tmp/checkpoints"
|
| 54 |
+
os.makedirs(cache_dir, exist_ok=True)
|
| 55 |
+
|
| 56 |
checkpoint_path = hf_hub_download(
|
| 57 |
repo_id=repo_id,
|
| 58 |
filename=filename,
|
| 59 |
+
cache_dir=cache_dir,
|
| 60 |
local_files_only=False
|
| 61 |
)
|
| 62 |
print(f"✅ Checkpoint downloaded to: {checkpoint_path}")
|