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

[XPO] xpo trainer #1943

Merged
merged 47 commits into from
Sep 10, 2024
Merged

[XPO] xpo trainer #1943

merged 47 commits into from
Sep 10, 2024

Conversation

kashif
Copy link
Collaborator

@kashif kashif commented Aug 18, 2024

@kashif kashif marked this pull request as draft August 18, 2024 10:50
@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.

@kashif kashif marked this pull request as ready for review August 31, 2024 13:41
@kashif kashif requested a review from qgallouedec September 7, 2024 10:06
@qgallouedec qgallouedec linked an issue Sep 9, 2024 that may be closed by this pull request
@qgallouedec
Copy link
Member

kl isn't logged in XPO. Is it possible to have it logged?

@kashif kashif changed the title [XPO] initial xpo trainer [XPO] xpo trainer Sep 10, 2024
@qgallouedec
Copy link
Member

Is it possible to have it logged?

from @kashif

In the online-dpo what is the "kl" being logged?

"kl" is the approximate KL div from the ref model distribution to the trained model distribution. Approximated as:

kl = logprobs - ref_logprobs

Your calculation abdf1a5 seems correct to me

        # Calculate KL divergence for model and ref data
         kl_model_data = model_logprobs_model_data - ref_logprobs_model_data
         kl_ref_data = model_logprobs_ref_data - ref_logprobs_ref_data
         mean_kl = (kl_model_data.sum(1) + kl_ref_data.sum(1)).mean() / 2
         self.stats["objective/kl"].append(gather_mean(mean_kl))

Copy link
Member

@qgallouedec qgallouedec left a comment

Choose a reason for hiding this comment

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

Very nice work @kashif

@kashif kashif merged commit 3511856 into huggingface:main Sep 10, 2024
9 checks passed
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.

Disable the dropout by default in Online DPO
3 participants