Fix device casting for zimage in some instances
This commit is contained in:
@@ -300,8 +300,8 @@ 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()
|
||||||
gen_config.width = int(gen_config.width // sc * sc)
|
gen_config.width = int(gen_config.width // sc * sc)
|
||||||
@@ -326,7 +326,8 @@ class ZImageModel(BaseModel):
|
|||||||
text_embeddings: PromptEmbeds,
|
text_embeddings: PromptEmbeds,
|
||||||
**kwargs,
|
**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 = latent_model_input.unsqueeze(2)
|
||||||
latent_model_input_list = list(latent_model_input.unbind(dim=0))
|
latent_model_input_list = list(latent_model_input.unbind(dim=0))
|
||||||
|
|||||||
Reference in New Issue
Block a user