This directory illustrates how to run Stable Diffusion through MAX Engine. Specifically, this example extracts StableDiffusion-1.5 from Hugging Face and executes it via the MAX Engine Python API.
If you have magic
, you can run the
following command:
magic run bash run.sh
Create a Conda environment, activate that environment, and install the requirements:
# Create a Conda environment if you don't have one
conda create -n max-repo
# Update the environment with the environment.yml file
conda env update -n max-repo -f environment.yml --prune
# Run the example
conda run -n max-repo --live-stream bash run.sh
Getting started with your own creative prompts is as simple as:
./text_to_image.py --prompt "my image description" -o my-image.png
But of course, there are some additional settings that can be tweaked for more
fine-grained control over image output. See ./text_to_image.py --help
for
details.
-
download-model.py
: Downloads runwayml/stable-diffusion-v1-5 and exports it as ONNX. -
text_to_image.py
: Example program that runs full stable-diffusion pipeline through MAX Engine in order to generate images from the given prompt.