Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,8 @@ def __call__(
crops_coords = None
resize_mode = "default"

original_image = None
prompt_image = None
if image is not None and not (isinstance(image, torch.Tensor) and image.size(1) == self.latent_channels):
image = self.image_processor.resize(image, calculated_height, calculated_width)
original_image = image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,10 @@ def __call__(

device = self._execution_device
# 3. Preprocess image
condition_image_sizes = None
condition_images = None
vae_image_sizes = None
vae_images = None
if image is not None and not (isinstance(image, torch.Tensor) and image.size(1) == self.latent_channels):
if not isinstance(image, list):
image = [image]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ def encode_prompt(
def check_inputs(
self,
prompt,
image,
strength,
height,
width,
Expand All @@ -321,6 +322,9 @@ def check_inputs(
callback_on_step_end_tensor_inputs=None,
max_sequence_length=None,
):
if image is None:
raise ValueError("`image` input cannot be undefined for img2img generation.")

if strength < 0 or strength > 1:
raise ValueError(f"The value of strength should in [0.0, 1.0] but is {strength}")

Expand Down Expand Up @@ -651,6 +655,7 @@ def __call__(
# 1. Check inputs. Raise error if not correct
self.check_inputs(
prompt,
image,
strength,
height,
width,
Expand Down