Stable Diffusion Modal
This is the script to execute Stable Diffusion on Modal.
Requirements
The app requires the following to run:
- python: > 3.10
- modal-client
- A token for Modal.
The modal-client is the Python library. In order to install that:
pip install modal-client
And you need a modal token to use this script:
modal token new
Please see the documentation of Modal for modals and tokens.
Getting Started
To use the script, execute the below.
- git clone the repository.
- Create the
./setup_files/.envfile and set a huggingface API token with reference to./setup_files/.env.example. - Copy
./setup_files/config.sample.ymlto./setup_files/config.yml - Open the Makefile and set prompts.
- Execute
make deploycommand. An application will be deployed to Modal. - Execute
make runcommand.
Images are generated and output to the outputs/ directory.
Directory structure
.
├── Makefile
├── README.md
├── sdcli/ # A directory with scripts to run inference.
│ ├── __init__.py
│ ├── outputs/ # Images are outputted this directory.
│ ├── txt2img.py # A script to run txt2img inference.
│ └── util.py
└── setup_files/ # A directory with config files.
├── .env # Secrets manager
├── Dockerfile # To build a base image.
├── config.yml # To set a model, vae and some tools.
├── requirements.txt
└── setup.py # Build an application to deploy on Modal.
Thank you.
Author
Description
Languages
Python
95.9%
Makefile
3%
Dockerfile
1.1%