Skip to content

Commit efc2266

Browse files
authored
Update train_instruct_pix2pix.py
Fix inconsistent random transform in instruct_pix2pix
1 parent 1ae9b05 commit efc2266

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/instruct_pix2pix/train_instruct_pix2pix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ def preprocess_images(examples):
695695
)
696696
# We need to ensure that the original and the edited images undergo the same
697697
# augmentation transforms.
698-
images = np.concatenate([original_images, edited_images])
698+
images = np.stack([original_images, edited_images])
699699
images = torch.tensor(images)
700700
images = 2 * (images / 255) - 1
701701
return train_transforms(images)
@@ -706,7 +706,7 @@ def preprocess_train(examples):
706706
# Since the original and edited images were concatenated before
707707
# applying the transformations, we need to separate them and reshape
708708
# them accordingly.
709-
original_images, edited_images = preprocessed_images.chunk(2)
709+
original_images, edited_images = preprocessed_images
710710
original_images = original_images.reshape(-1, 3, args.resolution, args.resolution)
711711
edited_images = edited_images.reshape(-1, 3, args.resolution, args.resolution)
712712

0 commit comments

Comments
 (0)