Reduce Your Serverless Automatic1111 Start Time
Blog post from RunPod
Users are utilizing the Automatic1111 stable diffusion repository not only as a graphical user interface but also as an API layer, and optimizing the startup time can be crucial for scaling services built on top of it. The article discusses two primary performance optimizations: caching necessary Hugging Face files and pre-calculating the model hash, both achieved through a cache.py script executed during the Dockerfile build process. This script downloads files to the Hugging Face cache to avoid repeated downloads on serverless template cold starts and calculates the model hash to store it for faster access. The startup time for Automatic1111 is highly dependent on CPU speed, showing a linear relationship with single-core performance, though time is still consumed by importing the PyTorch and Gradio modules. Future discussions will address possible optimizations for these import times.