Skip to content
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

SDXL Turbo support and example launch #6473

Merged
merged 8 commits into from
Mar 6, 2024

Conversation

bram-w
Copy link
Contributor

@bram-w bram-w commented Jan 5, 2024

What does this PR do?

I added an --is_turbo argument to the new Diffusion-DPO scripts to support DPO tuning of the 4-step SDXL Turbo model. I also added an example call in the corresponding README

Before submitting

Who can review?

@sayakpaul

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@@ -61,6 +61,34 @@ accelerate launch train_diffusion_dpo_sdxl.py \
--push_to_hub
```

## SDXL Turbo training command
Copy link
Member

Choose a reason for hiding this comment

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

Possible to maybe add a note that it enables 4-steps sampling?

parser.add_argument(
"--is_turbo",
action="store_true",
help=("Use if tuning SDXL Turbo instead of SDXL"),
Copy link
Member

@sayakpaul sayakpaul Jan 6, 2024

Choose a reason for hiding this comment

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

nit: if we remove the help statement out of the brackets and remove the comma it probably will go to the line above.

Comment on lines +941 to +942
timesteps_0_to_3 = timesteps % 4
timesteps = 250 * timesteps_0_to_3 + 249
Copy link
Member

Choose a reason for hiding this comment

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

Can this be explained in the comments a bit? I know about the 4-step part that was discussed in the ADD paper for training of the student.

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks much.

Just some nits.

@radames
Copy link
Contributor

radames commented Jan 6, 2024

hi @bram-w could we also have this setup for SD-turbo version? which is based on SD2.1, thanks

@sayakpaul
Copy link
Member

@bram-w let me know if you need any help :)

Copy link
Contributor

@radames radames left a comment

Choose a reason for hiding this comment

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

@bram-w testing your script you might also need to change the guidance scale and num steps on the validation step, you could add these lines

   guidance_scale = 5.0
    num_inference_steps = 25
    if args.is_turbo:
        guidance_scale = 0.0
        num_inference_steps = 4

and add the params here

for prompt in VALIDATION_PROMPTS:
with context:
image = pipeline(prompt, num_inference_steps=25, generator=generator).images[0]
images.append(image)

and here

pipeline(prompt, num_inference_steps=25, generator=generator).images[0] for prompt in VALIDATION_PROMPTS

wdyt @sayakpaul

Copy link

github-actions bot commented Feb 5, 2024

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot added the stale Issues that haven't received updates label Feb 5, 2024
@yiyixuxu yiyixuxu removed the stale Issues that haven't received updates label Feb 5, 2024
@yiyixuxu
Copy link
Collaborator

yiyixuxu commented Feb 5, 2024

any update on this PR?

@sayakpaul
Copy link
Member

@bram-w this PR is already in pretty good state. Let us know if and how we can help to get this merged.

Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot added the stale Issues that haven't received updates label Mar 2, 2024
@sayakpaul
Copy link
Member

@bram-w a gentle ping :)

@sayakpaul
Copy link
Member

@radames do you want to push the changes you suggested to the script and we can then merge?

@radames
Copy link
Contributor

radames commented Mar 3, 2024

@radames do you want to push the changes you suggested to the script and we can then merge?

yes happy to do that, do I have permission to send commits here?

@sayakpaul
Copy link
Member

I think you should be able to since you are a member of the HF org.

@yiyixuxu yiyixuxu added training and removed stale Issues that haven't received updates labels Mar 3, 2024
@radames
Copy link
Contributor

radames commented Mar 6, 2024

done @sayakpaul

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Thanks a bunch!

@sayakpaul sayakpaul merged commit eb942b8 into huggingface:main Mar 6, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants