File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+
2+ import os
3+ from huggingface_hub import snapshot_download
4+ from safetensors import safe_open
5+ import torch
6+
7+ def inspect_checkpoint ():
8+ try :
9+ # Allow looking in the user's cache
10+ cache_dir = os .path .expanduser ("~/.cache/huggingface/hub" )
11+ print (f"Scanning cache dir: { cache_dir } " )
12+
13+ # We know the model is Lightricks/LTX-Video
14+ # We look for snapshots
15+ repo_id = "Lightricks/LTX-Video"
16+
17+ # Try to find it
18+ # We can use hf_hub_download to find the path without downloading if it exists
19+ from huggingface_hub import hf_hub_download
20+
21+ try :
22+ vae_path = hf_hub_download (repo_id , subfolder = "vae" , filename = "diffusion_pytorch_model.safetensors" )
23+ print (f"Found VAE checkpoint at: { vae_path } " )
24+
25+ with safe_open (vae_path , framework = "pt" ) as f :
26+ keys = f .keys ()
27+ print (f"Total keys in VAE checkpoint: { len (keys )} " )
28+ print ("Sample keys:" )
29+ for i , k in enumerate (keys ):
30+ if i < 20 :
31+ print (k )
32+ if "resnets" in k and "up_blocks" in k and i % 10 == 0 :
33+ print (f"Resnet key sample: { k } " )
34+
35+ except Exception as e :
36+ print (f"Could not find VAE checkpoint via hf_hub_download: { e } " )
37+
38+ except Exception as e :
39+ print (f"An error occurred: { e } " )
40+
41+ if __name__ == "__main__" :
42+ inspect_checkpoint ()
You can’t perform that action at this time.
0 commit comments