Spaces:
Sleeping
Sleeping
Updated the checkpoint path
Browse files
app.py
CHANGED
@@ -1,6 +1,17 @@
|
|
1 |
-
from huggingface_hub import
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
ckpt = torch.load(ckpt_path, map_location=device)
|
5 |
state = ckpt.get("model_state_dict", ckpt)
|
6 |
model.load_state_dict(state)
|
|
|
1 |
+
from huggingface_hub import snapshot_download
|
2 |
+
import os, glob, torch
|
3 |
+
|
4 |
+
local_dir = snapshot_download(repo_id="c1tr0n75/VoxelPathFinder")
|
5 |
+
|
6 |
+
# preferred path in subfolder
|
7 |
+
ckpt_path = os.path.join(local_dir, "training_outputs", "final_model.pth")
|
8 |
+
if not os.path.exists(ckpt_path):
|
9 |
+
# fallback: find any .pth
|
10 |
+
pths = [p for p in glob.glob(os.path.join(local_dir, "**", "*.pth"), recursive=True)]
|
11 |
+
if not pths:
|
12 |
+
raise FileNotFoundError("No .pth found in repo snapshot.")
|
13 |
+
ckpt_path = pths[0]
|
14 |
+
|
15 |
ckpt = torch.load(ckpt_path, map_location=device)
|
16 |
state = ckpt.get("model_state_dict", ckpt)
|
17 |
model.load_state_dict(state)
|