Skip to content

Commit dbb4a07

Browse files
feat(z-image): add add_noise option to Z-Image Denoise (#8739)
* feat(z-image): add `add_noise` option to Z-Image Denoise Add the same `add_noise` option that exists in FLUX Denoise to Z-Image Denoise. When set to false, no noise is added to the input latents during image-to-image, allowing for more controlled transformations.
1 parent be26351 commit dbb4a07

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

invokeai/app/invocations/z_image_denoise.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
title="Denoise - Z-Image",
5151
tags=["image", "z-image"],
5252
category="image",
53-
version="1.3.0",
53+
version="1.4.0",
5454
classification=Classification.Prototype,
5555
)
5656
class ZImageDenoiseInvocation(BaseInvocation):
@@ -69,6 +69,7 @@ class ZImageDenoiseInvocation(BaseInvocation):
6969
)
7070
denoising_start: float = InputField(default=0.0, ge=0, le=1, description=FieldDescriptions.denoising_start)
7171
denoising_end: float = InputField(default=1.0, ge=0, le=1, description=FieldDescriptions.denoising_end)
72+
add_noise: bool = InputField(default=True, description="Add noise based on denoising start.")
7273
transformer: TransformerField = InputField(
7374
description=FieldDescriptions.z_image_model, input=Input.Connection, title="Transformer"
7475
)
@@ -347,8 +348,12 @@ def _run_diffusion(self, context: InvocationContext) -> torch.Tensor:
347348

348349
# Prepare input latent image
349350
if init_latents is not None:
350-
s_0 = sigmas[0]
351-
latents = s_0 * noise + (1.0 - s_0) * init_latents
351+
if self.add_noise:
352+
# Noise the init_latents by the appropriate amount for the first timestep.
353+
s_0 = sigmas[0]
354+
latents = s_0 * noise + (1.0 - s_0) * init_latents
355+
else:
356+
latents = init_latents
352357
else:
353358
if self.denoising_start > 1e-5:
354359
raise ValueError("denoising_start should be 0 when initial latents are not provided.")

invokeai/frontend/web/src/services/api/schema.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25587,6 +25587,12 @@ export type components = {
2558725587
* @default 1
2558825588
*/
2558925589
denoising_end?: number;
25590+
/**
25591+
* Add Noise
25592+
* @description Add noise based on denoising start.
25593+
* @default true
25594+
*/
25595+
add_noise?: boolean;
2559025596
/**
2559125597
* Transformer
2559225598
* @description Z-Image model (Transformer) to load
@@ -25708,6 +25714,12 @@ export type components = {
2570825714
* @default 1
2570925715
*/
2571025716
denoising_end?: number;
25717+
/**
25718+
* Add Noise
25719+
* @description Add noise based on denoising start.
25720+
* @default true
25721+
*/
25722+
add_noise?: boolean;
2571125723
/**
2571225724
* Transformer
2571325725
* @description Z-Image model (Transformer) to load

0 commit comments

Comments
 (0)