Skip to content

Enable image resizing to adjust its height and width in StableDiffusionXLInstructPix2PixPipeline #6581

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
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion examples/instruct_pix2pix/train_instruct_pix2pix_sdxl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ def collate_fn(examples):
progress_bar.set_postfix(**logs)

### BEGIN: Perform validation every `validation_epochs` steps
if global_step % args.validation_steps == 0 or global_step == 1:
Copy link
Contributor Author

@kim-sangyeon kim-sangyeon Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to perform validation at every step? I believe we might not need to.

This PR did not originally intend for this change, but what do you think about removing the condition global_step==1?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable. Thank you!

if global_step % args.validation_steps == 0:
if (args.val_image_url_or_path is not None) and (args.validation_prompt is not None):
logger.info(
f"Running validation... \n Generating {args.num_validation_images} images with prompt:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ def __call__(
)

# 4. Preprocess image
image = self.image_processor.preprocess(image).to(device)
image = self.image_processor.preprocess(image, height=height, width=width).to(device)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!


# 5. Prepare timesteps
self.scheduler.set_timesteps(num_inference_steps, device=device)
Expand Down