stable-diffusion 0.1.9

Stable Diffusion
docs.rs failed to build stable-diffusion-0.1.9
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: stable-diffusion-0.1.5

Disclaimer Stable Diffusion is a trademark owned by Stability AI. Original repos: Stable Diffusion 1.5, Stable Diffusion 2.1, Stable Diffusion XL and XL-Turbo

Stable Diffusion

This is the Stable Diffusion core library.

Supported Versions

  • Stable Diffusion 1.5
  • Stable Diffusion 2.1
  • Stable Diffusion XL
  • Stable Diffusion Turbo

Backends

  • Cuda (default rust-feature)
  • Metal
  • Onnx
  • CPU

Examples

Image generation

use candle::Device;
use stable_diffusion::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let device = Device::new_cuda(0)?;
    let weights = StableDiffusionWeights::new(StableDiffusionVersion::XL, DType::F32);
    let parameters = StableDiffusionParameters::new(weights, device, DType::F16)?;
    let stable_diffusion = StableDiffusion::new(parameters)?;
    let args = GenerationParameters::new("A green apple");
    let image = stable_diffusion.generate(args)?;
    image.save("output.png")?;
    Ok(())
}