Skip to content

Commit 68064e2

Browse files
committed
Updated readme
1 parent 4348323 commit 68064e2

1 file changed

Lines changed: 23 additions & 16 deletions

File tree

README.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ StableDiffusionCpp.Progress += (_, args) => Console.WriteLine($"PROGRESS {args.S
2727

2828
Image<ColorRGB>? treeWithTiger;
2929
// Load a StableDiffusion model in a using block to unload it again after the two images are created
30-
using (DiffusionModel sd = ModelBuilder.StableDiffusion(@"<path to model")
31-
// .WithVae(@"<optional path to vae>")
32-
.WithMultithreading()
33-
.WithFlashAttention()
34-
.Build())
30+
using (DiffusionModel sd = new(DiffusionModelParameter.Create()
31+
.WithModelPath(@"N:\StableDiffusion\stable-diffusion-webui\models\Stable-diffusion\animagineXLV3_v30.safetensors")
32+
// .WithVae(@"<optional path to vae>")
33+
.WithMultithreading()
34+
.WithFlashAttention()))
3535
{
3636
// Create a image from a prompt
3737
Image<ColorRGB>? tree = sd.GenerateImage(ImageGenerationParameter.TextToImage("A beautiful tree standing on a small hill").WithSDXLDefaults());
@@ -43,17 +43,24 @@ using (DiffusionModel sd = ModelBuilder.StableDiffusion(@"<path to model")
4343
File.WriteAllBytes("image2.png", treeWithTiger.ToPng());
4444
}
4545

46-
// Load a flux kontext model
47-
using DiffusionModel flux = ModelBuilder.Flux(@"<path to flux-model.gguf>",
48-
@"<path to clip_l.safetensors>",
49-
@"<path to t5xxl_fp16.safetensors>",
50-
@"<path to ae.safetensors>")
51-
.WithMultithreading()
52-
.WithFlashAttention()
53-
.Build();
54-
55-
// Perform an edit on the previosly created image
56-
Image<ColorRGB>? tigerOnMoon = flux.GenerateImage(ImageGenerationParameter.TextToImage("Remove the hill with the grass and place the tree with the tiger on the moon").WithFluxDefaults().WithRefImages(treeWithTiger));
46+
// Load the qwen image edit model
47+
using DiffusionModel qwenContext = new(DiffusionModelParameter.Create()
48+
.WithDiffusionModelPath(@"<Qwen-Image-Edit-2509-path>")
49+
.WithQwen2VLPath(@"<Qwen2.5-VL-7B-Instruct-path>")
50+
.WithQwen2VLVisionPath(@"<Qwen2.5-VL-7B-Instruct.mmproj-path>")
51+
.WithVae(@"<qwen_image_vae-path>")
52+
.WithMultithreading()
53+
.WithFlashAttention()
54+
.WithFlowShift(3)
55+
.WithOffloadedParamsToCPU()
56+
.WithImmediatelyFreedParams());
57+
58+
// Perform an edit on the previously created image
59+
Image<ColorRGB>? tigerOnMoon = qwenContext.GenerateImage(ImageGenerationParameter.TextToImage("Remove the background and place the tree and the tiger on the moon.")
60+
.WithSize(1024, 1024)
61+
.WithCfg(2.5f)
62+
.WithSampler(Sampler.Euler)
63+
.WithRefImages(treeWithTiger));
5764
File.WriteAllBytes("image3.png", tigerOnMoon.ToPng());
5865
```
5966

0 commit comments

Comments
 (0)