Stable Diffusion (SDXL0.9 & 1.0)

Run a Stable Diffusion Text to Image Job


Generically, stable diffusion is what happens when you put a couple of drops of dye into a bucket of water. Given time, the dye randomly disperses and eventually settles into a uniform distribution which colours all the water evenly.

In computer science, you define rules for your (dye) particles to follow and the medium this takes place in.

Stable Diffusion is a machine learning model used for text-to-image processing (like Dall-E) and based on a diffusion probabilistic model that uses a transformer to generate images from text.

Getting Started


Before running sdxl, make sure you have the Lilypad CLI installed on your machine and your private key environment variable is set. This is necessary for operations within the Lilypad network.


Learn more about installing the Lilypad CLI and running SDXL with this video guide.

Run SDXL v0.9 or 1.0

When running SDXL pipelines in Lilypad, you have the choice between using the Base model or the Refiner model. Each serves a unique purpose in the image generation process:

  • Base Model: This is the primary model that generates the initial image based on your input prompt. It focuses on the broad aspects of the image, capturing the main theme and essential elements. The Base model is faster and uses less computational power.

  • Refiner Model: This model takes the image from the Base model and enhances it. It refines details, improves textures, and adjusts colors to increase the visual appeal and realism of the image. The Refiner model is used when you need higher quality and more detailed images.

To run SDXL Pipeline in Lilypad, you can use the following commands:

SDXL v0.9


lilypad run sdxl-pipeline:v0.9-base-lilypad3 -i Prompt="an astronaut floating against a white background"


lilypad run sdxl-pipeline:v0.9-refiner-lilypad3 -i Prompt="an astronaut floating against a white background"

SDXL 1.0


lilypad run sdxl-pipeline:v1.0-base-lilypad3 -i Prompt="an astronaut floating against a white background"


lilypad run sdxl-pipeline:v1.0-refiner-lilypad3 -i Prompt="an astronaut floating against a white background"

SDXL Output

To view the results in a local directory, navigate to the local folder.

open /tmp/lilypad/data/downloaded-files/QmZuE29GJVmenRUh72FQDgkMUT1Zdp967oEJvzjaDwGGVoResults of SDXL job on Output Directory

In the /outputs folder, you'll find the image:

To view the results on IPFS, navigate to the IPFS CID result output.

Please be patient! IPFS can take some time to propagate and doesn't always work immediately.

As Lilypad modules are currently deterministic, running this command with the same text prompt will produce the same image, since the same seed is also used (the default seed is 0).

Tuning an output

To change an image output, pass in a different seed number:

See this beginner-friendly article on how seeds work for more info on this

Lilypad can run SDXL v0.9 or SDXL v1.0 with the option to add tunables to improve or change the model output.

If you wish to specify more than one tunable, such as the number of steps, simply add more -i flags. For example, to improve the quality of the image generated add "Steps=x" with x = (Min: 5. Max: 200):

See the options and tunables section (below) for more information on what tunables are available.

`lilypad run sdxl-pipeline:v0.9-base-lilypad3 -i Prompt='a gigantic lilypad shaped space station' -i Steps=150` 

Options and tunables continued

The following tunables are available. All of them are optional, and have default settings that will be used if you do not provide them.

NameDescriptionDefaultAvailable options


A text prompt for the model

"question mark floating in space"

Any string


A seed for the model


Any valid non-negative integer


The number of steps to run the model for


Any valid non-negative integer from 5 to 200 inclusive


The scheduler to use for the model


normal, karras, exponential, sgm_uniform, simple, ddim_uniform


The sampler to use for the model


"euler", "euler_ancestral", "heun", "heunpp2", "dpm_2", "dpm_2_ancestral", "lms", "dpm_fast", "dpm_adaptive", "dpmpp_2s_ancestral", "dpmpp_sde", "dpmpp_sde_gpu", "dpmpp_2m", "dpmpp_2m_sde", "dpmpp_2m_sde_gpu", "dpmpp_3m_sde", "dpmpp_3m_sde_gpu", "ddpm", "lcm"


The output size requested in px


512, 768, 1024, 2048


How many images to produce


1, 2, 4, 8

See the usage sections for the runner of your choice for more information on how to set and use these variables.

Learn more about this Lilypad module on Github.

Looking for Smart Contracts?

Check out our smart contracts docs!

Last updated