farrell236 commited on
Commit
01a5dcf
·
verified ·
1 Parent(s): c4c8810

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import torch
3
+ from huggingface_hub import hf_hub_download
4
+
5
+ MODEL_REPO_ID = "farrell236/CephVIT"
6
+ MODEL_FILENAME = "best.pt"
7
+
8
+ hf_token = os.getenv("HF_TOKEN")
9
+ assert hf_token, "HF_TOKEN missing"
10
+
11
+ local_path = hf_hub_download(
12
+ repo_id=MODEL_REPO_ID,
13
+ filename=MODEL_FILENAME,
14
+ token=hf_token,
15
+ )
16
+
17
+ print("Downloaded to:", local_path)
18
+
19
+ ckpt = torch.load(local_path, map_location="cpu")
20
+ print("Type:", type(ckpt))
21
+
22
+ if isinstance(ckpt, dict):
23
+ print("Top-level keys:", list(ckpt.keys())[:20])
24
+ if "state_dict" in ckpt and isinstance(ckpt["state_dict"], dict):
25
+ print("state_dict keys:", list(ckpt["state_dict"].keys())[:20])