mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-26 23:29:53 +00:00
fix: hidream-o1-image speckle noise removal (#2407)
Co-authored-by: leejet <leejet714@gmail.com>
This commit is contained in:
parent
20e2b79f14
commit
571fc44437
3 changed files with 65 additions and 9 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
|
@ -13,10 +13,11 @@ var {
|
|||
width = 1024
|
||||
height = 1024
|
||||
|
||||
steps = 20
|
||||
method = "euler"
|
||||
scheduler = "discrete"
|
||||
steps = 28
|
||||
method = "lcm"
|
||||
scheduler = "lcm"
|
||||
noise_scale = 8.0
|
||||
extra_sample_args = "noise_scale_start=7.5,noise_scale_end=7.5,noise_clip_std=2.5"
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
@ -31,7 +32,7 @@ fn main() {
|
|||
rng = make_rng(rng_type, seed = seed)
|
||||
noise = tensor::affine(tensor::randn_like(base, rng = rng), scale = noise_scale)
|
||||
start = add_noise(predict, base, noise, sigma = sigmas[0])
|
||||
latent = sample(start, sigmas, predict = predict, method = method, rng = rng)
|
||||
latent = sample(start, sigmas, predict = predict, method = method, rng = rng, extra_args = extra_sample_args)
|
||||
image = vae_decode(vae, dit_to_vae_latents(vae, latent))
|
||||
image::save(output_path, image)
|
||||
return {image = image, latent = latent}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,28 @@
|
|||
# HiDream-O1-Image
|
||||
|
||||
HiDream-O1-Image uses a bundled model checkpoint. The example below uses the Dev checkpoint.
|
||||
HiDream-O1-Image supports text-to-image generation and reference-image editing
|
||||
with a bundled model checkpoint. Choose the Dev or full checkpoint.
|
||||
|
||||
## Supported variants
|
||||
|
||||
Use the settings below for text-to-image in stable-diffusion.cpp.
|
||||
|
||||
| Checkpoint | `--steps` | `--cfg-scale` | `-W` / `-H` | Sampling options |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Dev (distilled) | 28 | 1.0 | 1024 | `--sampling-method lcm --extra-sample-args noise_scale_start=7.5,noise_scale_end=7.5,noise_clip_std=2.5` |
|
||||
| HiDream-O1-Image (full) | 50 | 5.0 | 2048 (1024 works) | `--sampling-method euler` |
|
||||
|
||||
For Dev, use `lcm` with the noise settings above to reduce white speckles seen
|
||||
with `euler`. The default LCM noise settings can produce nearly flat images.
|
||||
The Dev settings were tested with Q5_0 GGUF weights at 768×768 and 1024×1024.
|
||||
Use the default flow shift for the full checkpoint.
|
||||
|
||||
## Model files
|
||||
|
||||
| Component | Weights and downloads | CLI option | Requirement |
|
||||
| --- | --- | --- | --- |
|
||||
| HiDream-O1-Image-Dev | [Safetensors](https://huggingface.co/Comfy-Org/HiDream-O1-Image/tree/main/checkpoints) | `--model` | Choose matching variant |
|
||||
| HiDream-O1-Image | [Safetensors](https://huggingface.co/Comfy-Org/HiDream-O1-Image/tree/main/checkpoints) | `--model` | Choose matching variant |
|
||||
| HiDream-O1-Image-Dev | [Safetensors](https://huggingface.co/Comfy-Org/HiDream-O1-Image/tree/main/checkpoints), [GGUF](https://huggingface.co/Solictous/HiDream-O1-Image-GGUF/blob/main/hidream_o1_image_dev_q5_0_akv.gguf) | `--model` | Choose matching variant |
|
||||
| HiDream-O1-Image | [Safetensors](https://huggingface.co/Comfy-Org/HiDream-O1-Image/tree/main/checkpoints), [GGUF](https://huggingface.co/Solictous/HiDream-O1-Image-GGUF/blob/main/hidream_o1_image_q5_0_akv.gguf) | `--model` | Choose matching variant |
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
@ -17,6 +32,9 @@ Follow the [Web UI guide](../../examples/server/README.md#web-ui) to start the
|
|||
server, then select the recipe matching your weights. Fill the component slots
|
||||
below and click **Load models**.
|
||||
Use the files and compatibility requirements in [Model files](#model-files).
|
||||
The Dev recipe preselects `euler` in the Web UI sampler menu. To pass the LCM
|
||||
noise arguments for Dev text-to-image, use the [DGL script](#dgl) or the
|
||||
[Legacy CLI example](#hidream-o1-image-dev).
|
||||
|
||||
| Recipe | Component slots |
|
||||
| --- | --- |
|
||||
|
|
@ -62,8 +80,9 @@ noise = tensor::affine(tensor::randn_like(base, rng = rng), scale = noise_scale)
|
|||
start = add_noise(predict, base, noise, sigma = sigmas[0])
|
||||
```
|
||||
|
||||
Use the same RNG for initial noise and sampling. The noise scale is independent
|
||||
of the sampler's `eta` parameter.
|
||||
Use the same RNG for initial noise and sampling. The initial noise scale is
|
||||
independent of the sampler's `eta` parameter. The script passes
|
||||
`extra_sample_args` to `sample` to control the noise added between LCM steps.
|
||||
|
||||
### Legacy CLI
|
||||
|
||||
|
|
@ -77,7 +96,10 @@ CLI examples use the [shared path and shell conventions](README.md#example-conve
|
|||
.\bin\Release\sd-cli.exe `
|
||||
-m ..\models\checkpoints\hidream_o1_image_dev_bf16.safetensors `
|
||||
-p "a lovely cat holding a sign says 'hidream o1 cpp'" `
|
||||
--steps 28 `
|
||||
--cfg-scale 1.0 `
|
||||
--sampling-method lcm `
|
||||
--extra-sample-args noise_scale_start=7.5,noise_scale_end=7.5,noise_clip_std=2.5 `
|
||||
-H 1024 `
|
||||
-W 1024 `
|
||||
-v
|
||||
|
|
@ -89,7 +111,10 @@ CLI examples use the [shared path and shell conventions](README.md#example-conve
|
|||
./bin/sd-cli \
|
||||
-m ../models/checkpoints/hidream_o1_image_dev_bf16.safetensors \
|
||||
-p "a lovely cat holding a sign says 'hidream o1 cpp'" \
|
||||
--steps 28 \
|
||||
--cfg-scale 1.0 \
|
||||
--sampling-method lcm \
|
||||
--extra-sample-args noise_scale_start=7.5,noise_scale_end=7.5,noise_clip_std=2.5 \
|
||||
-H 1024 \
|
||||
-W 1024 \
|
||||
-v
|
||||
|
|
@ -97,6 +122,36 @@ CLI examples use the [shared path and shell conventions](README.md#example-conve
|
|||
|
||||
<img width="256" alt="HiDream-O1-Image-Dev example" src="../../assets/hidream-o1/dev_example.png" />
|
||||
|
||||
#### HiDream-O1-Image (full)
|
||||
|
||||
**Windows (PowerShell)**
|
||||
|
||||
```powershell
|
||||
.\bin\Release\sd-cli.exe `
|
||||
-m ..\models\checkpoints\hidream_o1_image_bf16.safetensors `
|
||||
-p "a lovely cat holding a sign says 'hidream o1 cpp'" `
|
||||
--steps 50 `
|
||||
--cfg-scale 5.0 `
|
||||
--sampling-method euler `
|
||||
-H 1024 `
|
||||
-W 1024 `
|
||||
-v
|
||||
```
|
||||
|
||||
**Linux/macOS**
|
||||
|
||||
```sh
|
||||
./bin/sd-cli \
|
||||
-m ../models/checkpoints/hidream_o1_image_bf16.safetensors \
|
||||
-p "a lovely cat holding a sign says 'hidream o1 cpp'" \
|
||||
--steps 50 \
|
||||
--cfg-scale 5.0 \
|
||||
--sampling-method euler \
|
||||
-H 1024 \
|
||||
-W 1024 \
|
||||
-v
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
The initial noise scale defaults to 8. Use `--eta` (`sample.eta` in the C API)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue