Skip to content

Commit 9441980

Browse files
authored
Correct image transform using stack instead of concatenate
Follow huggingface#10698
1 parent 23ebbb4 commit 9441980

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/research_projects/instructpix2pix_lora/train_instruct_pix2pix_lora.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ def preprocess_images(examples):
788788
)
789789
# We need to ensure that the original and the edited images undergo the same
790790
# augmentation transforms.
791-
images = np.concatenate([original_images, edited_images])
791+
images = np.stack([original_images, edited_images])
792792
images = torch.tensor(images)
793793
images = 2 * (images / 255) - 1
794794
return train_transforms(images)
@@ -799,7 +799,7 @@ def preprocess_train(examples):
799799
# Since the original and edited images were concatenated before
800800
# applying the transformations, we need to separate them and reshape
801801
# them accordingly.
802-
original_images, edited_images = preprocessed_images.chunk(2)
802+
original_images, edited_images = preprocessed_images
803803
original_images = original_images.reshape(-1, 3, args.resolution, args.resolution)
804804
edited_images = edited_images.reshape(-1, 3, args.resolution, args.resolution)
805805

0 commit comments

Comments
 (0)