3.0.0 - Flux
@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:
- Rename all usages of
StableDiffusionModel
toDiffusionModel
. - Rename all usages of
StableDiffusionParameter
toDiffusionParameter
. - If you use upscaling, migrate to the new
UpscaleModel
- it's no longer part of the diffusion model. - Change all static-operations (logs, custom native library loading, system info) from using
StableDiffusionModel
toStableDiffusionCpp
- 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
- Flux-support by @DarthAffe in #24
- Update README.md by @DarthAffe in #25
Full Changelog: 2.2.1...3.0.0
Based on: https://github.com/leejet/stable-diffusion.cpp/releases/tag/master-5c561ea