Fixed some fringe cases for qwen image edit.
This commit is contained in:
1 parent
77cf3b824f
commit
0c9e1c3deb
1 file changed
+8
@@ -166,6 +166,12 @@ class QwenImageEditPlusModel(QwenImageModel):
|
|||||||
if self.pipeline.text_encoder.device != self.device_torch:
|
if self.pipeline.text_encoder.device != self.device_torch:
|
||||||
self.pipeline.text_encoder.to(self.device_torch)
|
self.pipeline.text_encoder.to(self.device_torch)
|
||||||
|
|
||||||
|
if control_images is None:
|
||||||
|
raise ValueError("Missing control images for QwenImageEditPlusModel")
|
||||||
|
|
||||||
|
if not isinstance(control_images, List):
|
||||||
|
control_images = [control_images]
|
||||||
|
|
||||||
if control_images is not None and len(control_images) > 0:
|
if control_images is not None and len(control_images) > 0:
|
||||||
for i in range(len(control_images)):
|
for i in range(len(control_images)):
|
||||||
# control images are 0 - 1 scale, shape (bs, ch, height, width)
|
# control images are 0 - 1 scale, shape (bs, ch, height, width)
|
||||||
@@ -200,6 +206,8 @@ class QwenImageEditPlusModel(QwenImageModel):
|
|||||||
):
|
):
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
batch_size, num_channels_latents, height, width = latent_model_input.shape
|
batch_size, num_channels_latents, height, width = latent_model_input.shape
|
||||||
|
if self.vae.device != self.device_torch:
|
||||||
|
self.vae.to(self.device_torch)
|
||||||
|
|
||||||
control_image_res = VAE_IMAGE_SIZE
|
control_image_res = VAE_IMAGE_SIZE
|
||||||
if self.model_config.model_kwargs.get("match_target_res", False):
|
if self.model_config.model_kwargs.get("match_target_res", False):
|
||||||
|
|||||||
Reference in new issue
Block a user