iolai26-solve / scripts /prepare_weights.py
rvpant
Swap weights to Qwen2.5-14B-Instruct-AWQ (shard 3 + metadata)
42c1db7
Raw
History Blame Contribute Delete
1.37 kB
"""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()