Thewhey-Brian commited on
Commit
1ccb133
·
1 Parent(s): c015721

Download meta_000650.json file needed for model loading

Browse files
Files changed (1) hide show
  1. app.py +26 -12
app.py CHANGED
@@ -16,28 +16,42 @@ os.environ.setdefault("XDG_CACHE_HOME", "/data/.cache")
16
 
17
  # Download model from HF if not present
18
  def download_model():
19
- """Download model weights from Hugging Face."""
20
  # Create all necessary directories
21
  os.makedirs("/data/chatsft_checkpoints/d20", exist_ok=True)
22
  os.makedirs("/data/.cache/huggingface", exist_ok=True)
23
 
24
  checkpoint_path = "/data/chatsft_checkpoints/d20/model_000650.pt"
 
25
 
26
- if os.path.exists(checkpoint_path):
27
- print(f"Model checkpoint found at {checkpoint_path}, skipping download")
28
  return
29
 
30
- print("Downloading model checkpoint from BrianGuo/nanochat-d20-chat...")
31
  from huggingface_hub import hf_hub_download
32
 
33
- # Download the specific checkpoint file
34
- hf_hub_download(
35
- repo_id="BrianGuo/nanochat-d20-chat",
36
- filename="chatsft_checkpoints/d20/model_000650.pt",
37
- local_dir="/data",
38
- local_dir_use_symlinks=False
39
- )
40
- print("Model downloaded successfully!")
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  def download_tokenizer():
43
  """Download tokenizer files from Hugging Face."""
 
16
 
17
  # Download model from HF if not present
18
  def download_model():
19
+ """Download model weights and metadata from Hugging Face."""
20
  # Create all necessary directories
21
  os.makedirs("/data/chatsft_checkpoints/d20", exist_ok=True)
22
  os.makedirs("/data/.cache/huggingface", exist_ok=True)
23
 
24
  checkpoint_path = "/data/chatsft_checkpoints/d20/model_000650.pt"
25
+ meta_path = "/data/chatsft_checkpoints/d20/meta_000650.json"
26
 
27
+ if os.path.exists(checkpoint_path) and os.path.exists(meta_path):
28
+ print(f"Model checkpoint and metadata found, skipping download")
29
  return
30
 
31
+ print("Downloading model files from BrianGuo/nanochat-d20-chat...")
32
  from huggingface_hub import hf_hub_download
33
 
34
+ # Download the checkpoint file
35
+ if not os.path.exists(checkpoint_path):
36
+ print(" - Downloading model_000650.pt...")
37
+ hf_hub_download(
38
+ repo_id="BrianGuo/nanochat-d20-chat",
39
+ filename="chatsft_checkpoints/d20/model_000650.pt",
40
+ local_dir="/data",
41
+ local_dir_use_symlinks=False
42
+ )
43
+
44
+ # Download the metadata file
45
+ if not os.path.exists(meta_path):
46
+ print(" - Downloading meta_000650.json...")
47
+ hf_hub_download(
48
+ repo_id="BrianGuo/nanochat-d20-chat",
49
+ filename="chatsft_checkpoints/d20/meta_000650.json",
50
+ local_dir="/data",
51
+ local_dir_use_symlinks=False
52
+ )
53
+
54
+ print("Model files downloaded successfully!")
55
 
56
  def download_tokenizer():
57
  """Download tokenizer files from Hugging Face."""