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
9 changes: 7 additions & 2 deletions src/huggingface_inference_toolkit/diffusers_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,15 @@ def __call__(
logger.warning("Sending num_images_per_prompt > 1 to pipeline is not supported. Using default value 1.")

if "target_size" in kwargs:
kwargs["height"] = kwargs["target_size"].pop("height", None)
kwargs["width"] = kwargs["target_size"].pop("width", None)
kwargs["height"] = kwargs["target_size"].pop("height")
kwargs["width"] = kwargs["target_size"].pop("width")
kwargs.pop("target_size")

if kwargs.get("height") != kwargs.get("width"):
raise ValueError(
f"Provided `height={kwargs.get('height')}` and `width={kwargs.get('width')}`, but either both must have a value or both must be None (or not provided)."
)

if "output_type" in kwargs and kwargs["output_type"] != "pil":
kwargs.pop("output_type")
logger.warning("The `output_type` cannot be modified, and PIL will be used by default instead.")
Expand Down