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

Training to predict x0 in training example #1031

Merged
merged 4 commits into from
Nov 2, 2022
Merged

Conversation

lukovnikov
Copy link
Contributor

changed training example to add option to train model that predicts x0 (instead of eps), changed DDPM pipeline accordingly

…0 (instead of eps), changed DDPM pipeline accordingly
…edicts x0 (instead of eps), changed DDPM pipeline accordingly"

This reverts commit c5efb52.
…0 (instead of eps), changed DDPM pipeline accordingly
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 27, 2022

The documentation is not available anymore as the PR was closed or merged.

@patrickvonplaten
Copy link
Contributor

@patil-suraj @anton-l could you take a look here? :-)

Copy link
Contributor

@patil-suraj patil-suraj 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 lot @lukovnikov ! The PR looks good. Out of curiosity, what does SNR weighting do ? And is it only used when predicting x0 ?

@lukovnikov
Copy link
Contributor Author

@patil-suraj I'm not sure it's the best name for it, but it's the weighting that is equivalent to having equal weights for all time steps in eps-prediction mode, after you transform the equations to x0-prediction mode. I followed https://arxiv.org/pdf/2202.00512v2.pdf but maybe it's older.

@lukovnikov
Copy link
Contributor Author

lukovnikov commented Nov 2, 2022

Btw, do you have any FID numbers to check how good the model gets? I ran a quick training in x0-prediction mode and generated 8k images, and against the 8k original images (after cropping), it gives me a FID of around 50. The images look ok but could be much better. I haven't had time to generate for the eps-prediction model yet so wanted to ask.

Copy link
Member

@anton-l anton-l left a comment

Choose a reason for hiding this comment

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

Nice addition @lukovnikov, thank you!
Before merging, the PR needs to pass the codestyle checks: just run pip install diffusers[quality] and make style from the repository root to reformat everything :)

Regarding FID: we don't have the numbers yet, and the metric PR in our evaluate library is still pending: huggingface/evaluate#276 If you want to implement it, that would be awesome!

@lukovnikov
Copy link
Contributor Author

lukovnikov commented Nov 2, 2022

@anton-l
Great, I'll try fix code style this week.
Regarding evaluation, can't we just write the images to folders (both from the dataset and from the model) and run one of the existing tools from command-line (torch-fidelity or pytorch-fid), at least for now? I'm always skeptical and paranoid of reimplementations and when I can't see both image sets.

@anton-l
Copy link
Member

anton-l commented Nov 2, 2022

@lukovnikov yes, saving the eval predictions at the end of training a good option too! Let's do it in a follow-up PR 🚀

The style checks pass now, merging 🤗

@anton-l anton-l merged commit cbcd051 into huggingface:main Nov 2, 2022
@lukovnikov
Copy link
Contributor Author

Huh, i was looking but some pytorch checks were failing although it looked like it was something about stable diffusion.

@lukovnikov
Copy link
Contributor Author

I currently have a small script to save the flowers dataset in the form it's being trained with in a folder, and I'm writing a separate script to sample from a model (DDPM works but I'm still working on DDIM sampling).

@anton-l
Copy link
Member

anton-l commented Nov 2, 2022

Yeah, those failing tests were the Apple M1 issues in our testing setup, all good now :)

PhaneeshB pushed a commit to nod-ai/diffusers that referenced this pull request Mar 1, 2023
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* changed training example to add option to train model that predicts x0 (instead of eps), changed DDPM pipeline accordingly

* Revert "changed training example to add option to train model that predicts x0 (instead of eps), changed DDPM pipeline accordingly"

This reverts commit c5efb52.

* changed training example to add option to train model that predicts x0 (instead of eps), changed DDPM pipeline accordingly

* fixed code style

Co-authored-by: lukovnikov <lukovnikov@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants