Skip to content

3.0.0 - Flux

Compare
Choose a tag to compare
@github-actions github-actions released this 25 Aug 14:59
· 34 commits to master since this release
f988643

fluxnet

@leejet did it :) flux support got added to stable-diffusion.cpp.

Since the flux worklow is a bit different compared to stable diffusion I refactored the model creation to make that a bit easier. (I'm not super happy with the way it is now so it might change again in the future.)
This causes current code to break due to some renamings, api changes and changed default values.
The usage of the new fluent API is not enforced though, so a minimal migration would be:

  1. Rename all usages of StableDiffusionModel to DiffusionModel .
  2. Rename all usages of StableDiffusionParameter to DiffusionParameter.
  3. If you use upscaling, migrate to the new UpscaleModel - it's no longer part of the diffusion model.
  4. Change all static-operations (logs, custom native library loading, system info) from using StableDiffusionModel to StableDiffusionCpp
  5. Check your parameters as some defaults changed!

To use flux models you have to convert them to gguf. This can be done like this:

StableDiffusionCpp.Convert(@"<path to flux.safetensors>", string.Empty, Quantization.Q8_0, @"<output path flux_Q8_0.gguf>");

Example

The image above is created using this code:

using DiffusionModel model = ModelBuilder.Flux(@"<path>\flux1-dev_Q6_K.gguf",
                                               @"<path>\clip_l.safetensors",
                                               @"<path>\t5xxl_fp16.safetensors",
                                               @"<path>\ae.safetensors")
                                         .WithMultithreading()
                                         .Build();

IImage<ColorRGB> image = model.TextToImage("a big piece of parchment with a oil painting on it, the painting looks old with some cracks but is of high quality, it shows a lovely cat holding a sign reading 'flux.NET'");
File.WriteAllBytes("output.png", image.ToPng());

What's Changed

Full Changelog: 2.2.1...3.0.0


Based on: https://github.com/leejet/stable-diffusion.cpp/releases/tag/master-5c561ea