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

[core] Add warning when negative KL #239

Merged
merged 4 commits into from
Mar 22, 2023
Merged

[core] Add warning when negative KL #239

merged 4 commits into from
Mar 22, 2023

Conversation

younesbelkada
Copy link
Contributor

What does this PR do?

Fixes: #235

The warning message will be displayed only once, if there is a repetition, as described in the official documentation of warnings package: https://docs.python.org/2/library/warnings.html / https://stackoverflow.com/questions/22661745/why-only-one-warning-in-a-loop

cc @lvwerra

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Mar 22, 2023

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

Copy link
Member

@lvwerra lvwerra left a comment

Choose a reason for hiding this comment

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

Great idea, however it's the "objective/kl" that becomes negative with the wrong generation kwargs :)

@younesbelkada
Copy link
Contributor Author

Indeed! Just fixed it :D

trl/trainer/ppo_trainer.py Outdated Show resolved Hide resolved
Co-authored-by: Leandro von Werra <lvwerra@users.noreply.github.com>
@younesbelkada younesbelkada merged commit 9b60207 into main Mar 22, 2023
@younesbelkada younesbelkada deleted the kl-neg branch March 22, 2023 11:18
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.

Add warning when KL-divergence is negative
3 participants