Skip to content

[core] Add warning when negative KL#239

Merged
younesbelkada merged 4 commits intomainfrom
kl-neg
Mar 22, 2023
Merged

[core] Add warning when negative KL#239
younesbelkada merged 4 commits intomainfrom
kl-neg

Conversation

@younesbelkada
Copy link
Copy Markdown
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
Copy Markdown

HuggingFaceDocBuilderDev commented Mar 22, 2023

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

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Indeed! Just fixed it :D

Comment thread trl/trainer/ppo_trainer.py Outdated
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
yxliu-TAMU pushed a commit to mincheolseong/ECEN743-GRPO-Project-Proposal that referenced this pull request Apr 20, 2025
* add warning

* oops

* fix

* Update trl/trainer/ppo_trainer.py

Co-authored-by: Leandro von Werra <lvwerra@users.noreply.github.com>

---------

Co-authored-by: Leandro von Werra <lvwerra@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.

Add warning when KL-divergence is negative

3 participants