Skip to content

Commit b693aff

Browse files
authored
fix: resize transform now preserves aspect ratio (#1804)
1 parent 8a4c3e5 commit b693aff

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/text_to_image/train_text_to_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ def tokenize_captions(examples, is_train=True):
493493

494494
train_transforms = transforms.Compose(
495495
[
496-
transforms.Resize((args.resolution, args.resolution), interpolation=transforms.InterpolationMode.BILINEAR),
496+
transforms.Resize(args.resolution, interpolation=transforms.InterpolationMode.BILINEAR),
497497
transforms.CenterCrop(args.resolution) if args.center_crop else transforms.RandomCrop(args.resolution),
498498
transforms.RandomHorizontalFlip() if args.random_flip else transforms.Lambda(lambda x: x),
499499
transforms.ToTensor(),

examples/text_to_image/train_text_to_image_flax.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def tokenize_captions(examples, is_train=True):
333333

334334
train_transforms = transforms.Compose(
335335
[
336-
transforms.Resize((args.resolution, args.resolution), interpolation=transforms.InterpolationMode.BILINEAR),
336+
transforms.Resize(args.resolution, interpolation=transforms.InterpolationMode.BILINEAR),
337337
transforms.CenterCrop(args.resolution) if args.center_crop else transforms.RandomCrop(args.resolution),
338338
transforms.RandomHorizontalFlip() if args.random_flip else transforms.Lambda(lambda x: x),
339339
transforms.ToTensor(),

0 commit comments

Comments
 (0)