marquee / download_model.py
mamuflih13's picture
chores
4778b0b
Raw
History Blame Contribute Delete
1.26 kB
import os
import sys
MODEL_ID = "Qwen/Qwen2.5-VL-7B-Instruct"
# MODEL_ID = "Qwen2.5-VL-3B-Instruct"
def main():
try:
from huggingface_hub import snapshot_download
except ImportError:
print("[error] huggingface_hub not installed. Run: pip install huggingface_hub")
sys.exit(1)
token = os.environ.get("HF_TOKEN")
if not token:
print("[info] No HF_TOKEN set. Download will work but rate-limited.")
print("[info] Optional: set HF_TOKEN env var for faster downloads.")
print(f"[info] Downloading {MODEL_ID} to HF cache...")
print("[info] This is ~16 GB. First time: ~5-30 min depending on connection.")
print("[info] Safe to Ctrl+C and resume — will pick up where it left off.\n")
try:
path = snapshot_download(
repo_id=MODEL_ID,
token=token,
resume_download=True,
)
print(f"\n[done] Model cached at: {path}")
print("[done] You can now run: python app.py")
except KeyboardInterrupt:
print("\n[interrupted] Partial download saved. Run again to resume.")
sys.exit(0)
except Exception as e:
print(f"\n[error] Download failed: {e}")
sys.exit(1)
if __name__ == "__main__":
main()