This is an example of creating a RunPod serverless worker for Stable Diffusion v2 using cog-stable-diffusion as the base.
This is an implementation of the Diffusers Stable Diffusion v2.1 as a Cog model. Cog packages machine learning models as standard containers.
First, download the pre-trained weights:
cog run script/download-weights
Then, you can run predictions:
cog predict -i prompt="monkey scuba diving"
These are the changes made to the base repo.
cog.yaml
- Addrunpod
as a dependency- Add
runpod_infer.py
file - This defines how the worker interacts with your model, the file name is arbitrary.