File size: 1,372 Bytes
f6c1260
 
 
 
 
 
 
379f378
 
 
 
f6c1260
 
 
 
379f378
 
 
 
 
 
 
42c1db7
379f378
 
 
 
f6c1260
 
 
 
 
 
379f378
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""Download the chosen model directly into the repo root, per the submission
convention (MODEL_ID = "." — weights ship inside the HF repo and load from
the working directory).

Downloads with local_dir (no separate HF cache copy — the weights exist once
on disk, plus git-lfs objects after committing). Weight files are picked up
by git-lfs via .gitattributes (*.safetensors etc.).

Usage:
  python scripts/prepare_weights.py [model_id] [dest]

Default model: Qwen/Qwen2.5-7B-Instruct-AWQ (~5.6 GB, Apache-2.0 —
redistribution-safe per the competition's licensing rule; fits the T4 with
headroom for batched generation). Swap to Qwen/Qwen2.5-14B-Instruct-AWQ
(~10 GB) on a machine with ~25 GB free disk.
"""

import sys
from pathlib import Path

from huggingface_hub import snapshot_download

DEFAULT_MODEL = "Qwen/Qwen2.5-14B-Instruct-AWQ"


def main() -> None:
    model_id = sys.argv[1] if len(sys.argv) > 1 else DEFAULT_MODEL
    dest = Path(sys.argv[2] if len(sys.argv) > 2 else ".").resolve()
    print(f"downloading {model_id} -> {dest}/ (direct, no cache copy)")
    snapshot_download(repo_id=model_id, local_dir=str(dest))
    print(f"done. Commit with git (LFS tracks the weight files), or verify "
          f"with: python -c \"from transformers import AutoConfig; "
          f"AutoConfig.from_pretrained('.')\"")


if __name__ == "__main__":
    main()