初始化项目,由ModelHub XC社区提供模型
Model: rpant/iolai26-solve Source: Original Platform
This commit is contained in:
37
scripts/prepare_weights.py
Normal file
37
scripts/prepare_weights.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""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()
|
||||
Reference in New Issue
Block a user