Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified assets/hidream-o1/dev_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions docs/dgl/hidream_o1_image/hidream-o1-image-dev-txt2img.dgl
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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}
Expand Down
65 changes: 60 additions & 5 deletions docs/models/hidream_o1_image.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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 |
| --- | --- |
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -89,14 +111,47 @@ 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
```

<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)
Expand Down