Skip to content

Conversation

@dg845
Copy link
Collaborator

@dg845 dg845 commented Feb 3, 2024

What does this PR do?

This PR fixes a bug in examples/research_projects/consistency_training/train_cm_ct_unconditional.py where the scalings_for_boundary_conditions function does not take into account sigma_min ($= \epsilon$ in the original CM paper) when calculating c_skip and c_out and thus does not satisfy the consistency model boundary condition $c_{\mbox{skip}}(\epsilon) = 1$ and $c_{\mbox{out}}(\epsilon) = 0$. The implementation should now correctly follow the parameterization given in Appendix C of the original Consistency Models paper.

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@patrickvonplaten
@sayakpaul
@patil-suraj

@sayakpaul sayakpaul requested a review from patil-suraj February 3, 2024 04:34
Comment on lines +1258 to +1259
c_skip_teacher, c_out_teacher = scalings_for_boundary_conditions(teacher_timesteps, args.sigma_min)
c_skip_student, c_out_student = scalings_for_boundary_conditions(student_timesteps, args.sigma_min)
Copy link
Member

Choose a reason for hiding this comment

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

Are we defaulting to reasonable values for these args?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sigma_min defaults to 0.002, which is the value of $\sigma_{min}$/$\epsilon$ used in the original Consistency Models paper and the improved Consistency Training paper (see Table 1 in the latter paper), which I believe is a reasonable default value.

(Note that sigma_min should be a small positive value rather than 0 to avoid numerical issues when using ODE solvers.)

Copy link
Member

Choose a reason for hiding this comment

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

Cool! Do you think it makes sense to add this info to the README as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have added documentation on the consistency training-specific hyperparameters to the README.

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.

Thank you! Just left a question.

@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.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 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 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Issues that haven't received updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants