Spaces:
Runtime error
Runtime error
Remove cache_model.py script and update references in README.md and performance-optimization.md to reflect the new path for model caching. This change ensures consistency in instructions for initializing the SDXL model cache using Modal storage.
1a92033 Download modal_deployments/cache_model.py from Agents-MCP-Hackathon/TubeGenius: direct link, hf CLI and curl.
- Browser
- Download file 2.3 kB
-
https://huggingface.co/spaces/Agents-MCP-Hackathon/TubeGenius/resolve/main/modal_deployments/cache_model.py
- Command line
-
hf download hf://spaces/Agents-MCP-Hackathon/TubeGenius/modal_deployments/cache_model.py
-
curl -L -o cache_model.py https://huggingface.co/spaces/Agents-MCP-Hackathon/TubeGenius/resolve/main/modal_deployments/cache_model.py
2.3 kB
| #!/usr/bin/env python3 | |
| """ | |
| Utility script to initialize the SDXL model cache for faster thumbnail generation. | |
| Run this script once to download and cache the base SDXL model to Modal storage. | |
| After running this, all future thumbnail generations will be much faster since | |
| the model won't need to be downloaded from HuggingFace each time. | |
| Usage: | |
| python modal_deployments/cache_model.py | |
| """ | |
| import modal | |
| import sys | |
| def main(): | |
| """Initialize the SDXL model cache""" | |
| print("π Starting SDXL model cache initialization...") | |
| print("β° This will take about 5-10 minutes but only needs to be done once.") | |
| print("π‘ After this completes, all future thumbnail generations will be much faster!\n") | |
| try: | |
| # Use Modal CLI to call the function directly | |
| import subprocess | |
| print("π§ Calling Modal function via CLI...") | |
| result = subprocess.run([ | |
| "modal", "run", | |
| "modal_deployments.modal_functions::initialize_model_cache" | |
| ], capture_output=True, text=True, timeout=1800) | |
| if result.returncode == 0: | |
| print("β SUCCESS!") | |
| print("SDXL model cached successfully! Future generations will be much faster.") | |
| print("\nπ Your SDXL model is now cached! Future thumbnail generations will be much faster.") | |
| print("π Expected speedup: ~30-40 seconds saved per generation") | |
| else: | |
| print("β ERROR!") | |
| print("Failed to cache SDXL model.") | |
| print(f"Error output: {result.stderr}") | |
| return 1 | |
| except subprocess.TimeoutExpired: | |
| print("β° Cache initialization is taking longer than expected (30 minutes).") | |
| print("This is normal for the first download. Please check Modal dashboard for progress.") | |
| return 1 | |
| except Exception as e: | |
| print(f"β Failed to initialize model cache: {e}") | |
| print("\nπ§ Troubleshooting:") | |
| print("1. Make sure you have Modal CLI installed and configured") | |
| print("2. Ensure your Modal app is deployed: modal deploy modal_deployments/modal_functions.py") | |
| print("3. Check your internet connection") | |
| return 1 | |
| return 0 | |
| if __name__ == "__main__": | |
| sys.exit(main()) |