#!/usr/bin/env python3 """Download model weights from HuggingFace model repository.""" import os from pathlib import Path # Always download weights from model repository repo = os.environ.get('FOUNDATIONPOSE_MODEL_REPO', 'gpue/foundationpose-weights') token = os.environ.get('HF_TOKEN') weights_dir = os.environ.get('FOUNDATIONPOSE_WEIGHTS_DIR', '/app/FoundationPose/weights') print(f'Downloading weights from {repo}...') try: from huggingface_hub import snapshot_download Path(weights_dir).mkdir(parents=True, exist_ok=True) snapshot_download( repo_id=repo, local_dir=weights_dir, token=token, repo_type='model' ) print('✓ Weights downloaded successfully') except Exception as e: print(f'✗ Weight download failed: {e}') raise