Skip to content
Merged
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
13 changes: 4 additions & 9 deletions src/diffusers/image_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,17 +531,12 @@ def preprocess(
)
image = torch.cat(image, axis=0)

# ensure the input is a list of images:
# - if it is a batch of images (4d torch.Tensor or np.ndarray), it is converted to a list of images (a list of 3d torch.Tensor or np.ndarray)
# - if it is a single image, it is converted to a list of one image
if isinstance(image, (np.ndarray, torch.Tensor)) and image.ndim == 4:
image = list(image)
if is_valid_image(image):
image = [image]
if not all(is_valid_image(img) for img in image):
if not is_valid_image_imagelist(image):
raise ValueError(
f"Input is in incorrect format: {[type(i) for i in image]}. Currently, we only support {', '.join(supported_formats)}"
f"Input is in incorrect format. Currently, we only support {', '.join(supported_formats)}"
)
if not isinstance(image, list):
image = [image]

if isinstance(image[0], PIL.Image.Image):
if crops_coords is not None:
Expand Down