Fix device casting for zimage in some instances

This commit is contained in:
Jaret Burkett committed 2026-05-23 10:37:33 -06:00
1 parent c6ecc03ccd
commit 644a6f9246
1 file changed
+2 -1
@@ -300,7 +300,7 @@ class ZImageModel(BaseModel):
generator: torch.Generator, generator: torch.Generator,
extra: dict, extra: dict,
): ):
self.model.to(self.device_torch, dtype=self.torch_dtype) if self.model.device == torch.device("cpu"):
self.model.to(self.device_torch) self.model.to(self.device_torch)
sc = self.get_bucket_divisibility() sc = self.get_bucket_divisibility()
@@ -326,6 +326,7 @@ class ZImageModel(BaseModel):
text_embeddings: PromptEmbeds, text_embeddings: PromptEmbeds,
**kwargs, **kwargs,
): ):
if self.model.device == torch.device("cpu"):
self.model.to(self.device_torch) self.model.to(self.device_torch)
latent_model_input = latent_model_input.unsqueeze(2) latent_model_input = latent_model_input.unsqueeze(2)