Skip to content

Add LANCZOS as default interplotation mode. #11463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Added LANCZOS as default interplotation mode
  • Loading branch information
Va16hav07 committed Apr 30, 2025
commit 0236a91d3ebe2f081eab9ec9cc51df2ef34c7128
16 changes: 9 additions & 7 deletions examples/controlnet/train_controlnet_sdxl.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def log_validation(vae, unet, controlnet, args, accelerator, weight_dtype, step,

for validation_prompt, validation_image in zip(validation_prompts, validation_images):
validation_image = Image.open(validation_image).convert("RGB")

try:
interpolation = getattr(transforms.InterpolationMode, args.image_interpolation_mode.upper())
except (AttributeError, KeyError):
Expand All @@ -145,11 +145,13 @@ def log_validation(vae, unet, controlnet, args, accelerator, weight_dtype, step,
f"Interpolation mode {args.image_interpolation_mode} is not supported. "
f"Please select one of the following: {', '.join(supported_interpolation_modes)}"
)

transform = transforms.Compose([
transforms.Resize(args.resolution, interpolation=interpolation),
transforms.CenterCrop(args.resolution),
])

transform = transforms.Compose(
[
transforms.Resize(args.resolution, interpolation=interpolation),
transforms.CenterCrop(args.resolution),
]
)
validation_image = transform(validation_image)

images = []
Expand Down Expand Up @@ -767,7 +769,7 @@ def prepare_train_dataset(dataset, accelerator):
f"Interpolation mode {args.image_interpolation_mode} is not supported. "
f"Please select one of the following: {', '.join(supported_interpolation_modes)}"
)

image_transforms = transforms.Compose(
[
transforms.Resize(args.resolution, interpolation=interpolation_mode),
Expand Down
Loading