diff --git a/examples/instruct_pix2pix/train_instruct_pix2pix.py b/examples/instruct_pix2pix/train_instruct_pix2pix.py index d7f1288f3804..d1caf281a2c5 100644 --- a/examples/instruct_pix2pix/train_instruct_pix2pix.py +++ b/examples/instruct_pix2pix/train_instruct_pix2pix.py @@ -695,7 +695,7 @@ def preprocess_images(examples): ) # We need to ensure that the original and the edited images undergo the same # augmentation transforms. - images = np.concatenate([original_images, edited_images]) + images = np.stack([original_images, edited_images]) images = torch.tensor(images) images = 2 * (images / 255) - 1 return train_transforms(images) @@ -706,7 +706,7 @@ def preprocess_train(examples): # Since the original and edited images were concatenated before # applying the transformations, we need to separate them and reshape # them accordingly. - original_images, edited_images = preprocessed_images.chunk(2) + original_images, edited_images = preprocessed_images original_images = original_images.reshape(-1, 3, args.resolution, args.resolution) edited_images = edited_images.reshape(-1, 3, args.resolution, args.resolution) diff --git a/examples/instruct_pix2pix/train_instruct_pix2pix_sdxl.py b/examples/instruct_pix2pix/train_instruct_pix2pix_sdxl.py index fafc50d092fb..5f01e2f2bb09 100644 --- a/examples/instruct_pix2pix/train_instruct_pix2pix_sdxl.py +++ b/examples/instruct_pix2pix/train_instruct_pix2pix_sdxl.py @@ -766,7 +766,7 @@ def preprocess_images(examples): ) # We need to ensure that the original and the edited images undergo the same # augmentation transforms. - images = np.concatenate([original_images, edited_images]) + images = np.stack([original_images, edited_images]) images = torch.tensor(images) images = 2 * (images / 255) - 1 return train_transforms(images) @@ -906,7 +906,7 @@ def preprocess_train(examples): # Since the original and edited images were concatenated before # applying the transformations, we need to separate them and reshape # them accordingly. - original_images, edited_images = preprocessed_images.chunk(2) + original_images, edited_images = preprocessed_images original_images = original_images.reshape(-1, 3, args.resolution, args.resolution) edited_images = edited_images.reshape(-1, 3, args.resolution, args.resolution)