mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-11 03:24:30 +00:00
feat: add Qwen Image 2.1 Turbo sigma preset (#2130)
This commit is contained in:
1 parent
792bcd344c
commit
d637cfb935
3 files changed
+18
-5
No files matched your search
@@ -32,6 +32,16 @@ Run the following commands from the build directory. Use image dimensions divisi
|
|||||||
|
|
||||||
To use GGUF diffusion weights, set `--diffusion-model` to the path of a file such as `qwen_image_2.1-Q4_K.gguf`.
|
To use GGUF diffusion weights, set `--diffusion-model` to the path of a file such as `qwen_image_2.1-Q4_K.gguf`.
|
||||||
|
|
||||||
|
### Turbo
|
||||||
|
|
||||||
|
For [Qwen Image 2.1 Turbo](https://huggingface.co/Qwen/Qwen-Image-2.1-Turbo), use the Turbo diffusion weights and select its fixed 8-step sigma schedule with `--sigmas qwen-image-2.1-turbo`. For example, add these sampling options to the command above:
|
||||||
|
|
||||||
|
```text
|
||||||
|
--sigmas qwen-image-2.1-turbo --steps 8 --cfg-scale 1.0 --sampling-method euler
|
||||||
|
```
|
||||||
|
|
||||||
|
The preset is equivalent to `--sigmas 1.0,0.978453,0.95418,0.926626,0.89508,0.845148,0.704534,0.414568,0.0`. It only supplies the sigma values; CFG scale and sampling method remain independently configurable. As with an explicit sigma list, the sigma count determines the actual number of sampling steps. The same preset name is also accepted by `--hires-sigmas` for the highres fix second pass.
|
||||||
|
|
||||||
### Image editing
|
### Image editing
|
||||||
|
|
||||||
Pass the reference image with `-r` and describe the edit in `-p`. Vision weights are required; the example below loads them separately with `--llm_vision`.
|
Pass the reference image with `-r` and describe the edit in `-p`. Vision weights are required; the example below loads them separately with `--llm_vision`.
|
||||||
|
|||||||
@@ -1475,6 +1475,9 @@ ArgOptions SDGenerationParams::get_options() {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
std::string sigmas_str = value;
|
std::string sigmas_str = value;
|
||||||
|
if (sigmas_str == "qwen-image-2.1-turbo") {
|
||||||
|
sigmas_str = "1.0,0.978453,0.95418,0.926626,0.89508,0.845148,0.704534,0.414568,0.0";
|
||||||
|
}
|
||||||
if (!sigmas_str.empty() && sigmas_str.front() == '[') {
|
if (!sigmas_str.empty() && sigmas_str.front() == '[') {
|
||||||
sigmas_str.erase(0, 1);
|
sigmas_str.erase(0, 1);
|
||||||
}
|
}
|
||||||
@@ -1721,11 +1724,11 @@ ArgOptions SDGenerationParams::get_options() {
|
|||||||
on_scheduler_arg},
|
on_scheduler_arg},
|
||||||
{"",
|
{"",
|
||||||
"--sigmas",
|
"--sigmas",
|
||||||
"custom sigma values for the sampler, comma-separated (e.g., \"14.61,7.8,3.5,0.0\").",
|
"custom sigma values for the sampler, comma-separated (e.g., \"14.61,7.8,3.5,0.0\") or preset: qwen-image-2.1-turbo.",
|
||||||
on_sigmas_arg},
|
on_sigmas_arg},
|
||||||
{"",
|
{"",
|
||||||
"--hires-sigmas",
|
"--hires-sigmas",
|
||||||
"custom sigma values for the highres fix second pass, comma-separated (e.g., \"0.85,0.725,0.421875,0.0\").",
|
"custom sigma values for the highres fix second pass, comma-separated (e.g., \"0.85,0.725,0.421875,0.0\") or preset: qwen-image-2.1-turbo.",
|
||||||
on_hires_sigmas_arg},
|
on_hires_sigmas_arg},
|
||||||
{"",
|
{"",
|
||||||
"--skip-layers",
|
"--skip-layers",
|
||||||
|
|||||||
@@ -2735,9 +2735,9 @@ sd::Tensor<float> StableDiffusionGGML::sample(const std::shared_ptr<DiffusionMod
|
|||||||
if (batch_cfg_ok) {
|
if (batch_cfg_ok) {
|
||||||
sd::Tensor<float> batched_out = run_batched_condition(*positive_condition, c_concat_override);
|
sd::Tensor<float> batched_out = run_batched_condition(*positive_condition, c_concat_override);
|
||||||
if (!batched_out.empty() && batched_out.dim() >= 4 && batched_out.shape()[3] == 2) {
|
if (!batched_out.empty() && batched_out.dim() >= 4 && batched_out.shape()[3] == 2) {
|
||||||
auto parts = sd::ops::chunk(batched_out, 2, 3);
|
auto parts = sd::ops::chunk(batched_out, 2, 3);
|
||||||
cond_out = std::move(parts[0]);
|
cond_out = std::move(parts[0]);
|
||||||
uncond_out = std::move(parts[1]);
|
uncond_out = std::move(parts[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user