Fix device casting for zimage in some instances
This commit is contained in:
parent
c6ecc03ccd
commit
644a6f9246
|
|
@ -300,8 +300,8 @@ class ZImageModel(BaseModel):
|
|||
generator: torch.Generator,
|
||||
extra: dict,
|
||||
):
|
||||
self.model.to(self.device_torch, dtype=self.torch_dtype)
|
||||
self.model.to(self.device_torch)
|
||||
if self.model.device == torch.device("cpu"):
|
||||
self.model.to(self.device_torch)
|
||||
|
||||
sc = self.get_bucket_divisibility()
|
||||
gen_config.width = int(gen_config.width // sc * sc)
|
||||
|
|
@ -326,7 +326,8 @@ class ZImageModel(BaseModel):
|
|||
text_embeddings: PromptEmbeds,
|
||||
**kwargs,
|
||||
):
|
||||
self.model.to(self.device_torch)
|
||||
if self.model.device == torch.device("cpu"):
|
||||
self.model.to(self.device_torch)
|
||||
|
||||
latent_model_input = latent_model_input.unsqueeze(2)
|
||||
latent_model_input_list = list(latent_model_input.unbind(dim=0))
|
||||
|
|
|
|||
Loading…
Reference in New Issue