c1tr0n75 commited on
Commit
17c84c4
·
verified ·
1 Parent(s): 757dc0d

Updated the checkpoint path

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -1,6 +1,17 @@
1
- from huggingface_hub import hf_hub_download
2
- ckpt_path = hf_hub_download(repo_id="c1tr0n75/VoxelPathFinder",
3
- filename="training_outputs/final_model.pth")
 
 
 
 
 
 
 
 
 
 
 
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)