[Bugfix] Fix Hardcoded Datatypes in Z-image (#1393)

Signed-off-by: Alex Brooks <albrooks@redhat.com>
This commit is contained in:
Alex Brooks authored and GitHub committed 2026-02-20 06:55:24 +00:00
1 parent 4f9731c920
commit 5295f0f81b
2 files changed
+2 -3

No files matched your search

@@ -564,14 +564,14 @@ class ZImagePipeline(nn.Module):
# Run CFG only if configured AND scale is non-zero
apply_cfg = self.do_classifier_free_guidance and current_guidance_scale > 0
latents_typed = latents.to(self.od_config.dtype)
if apply_cfg:
latents_typed = latents.to(self.transformer.dtype)
latent_model_input = latents_typed.repeat(2, 1, 1, 1)
prompt_embeds_model_input = prompt_embeds + negative_prompt_embeds
timestep_model_input = timestep.repeat(2)
else:
latent_model_input = latents.to(self.transformer.dtype)
latent_model_input = latents_typed
prompt_embeds_model_input = prompt_embeds
timestep_model_input = timestep
@@ -614,7 +614,6 @@ class ZImageTransformer2DModel(CachedTransformer):
quant_config: "QuantizationConfig | None" = None,
) -> None:
super().__init__()
self.dtype = torch.bfloat16
self.in_channels = in_channels
self.out_channels = in_channels
self.all_patch_size = all_patch_size