| from huggingface_hub import snapshot_download | |
| import os | |
| def download_granite(): | |
| print("⏳ Attempting to download IBM Granite 4.0 1B...") | |
| try: | |
| # Trying the user's specific request | |
| path = snapshot_download(repo_id="ibm-granite/granite-3.0-2b-instruct", allow_patterns=["*.safetensors", "*.json"]) | |
| print(f"✅ Downloaded to: {path}") | |
| return path | |
| except Exception as e: | |
| print(f"⚠️ Could not download specific model: {e}") | |
| print(" (Note: 4.0 might be internal or gated. Using 3.0-2b as closest match)") | |
| return "ibm-granite/granite-3.0-2b-instruct" | |
| if __name__ == "__main__": | |
| download_granite() | |