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

Log Token distribution of Query / Response #295

Merged
merged 6 commits into from
Apr 17, 2023
Merged

Log Token distribution of Query / Response #295

merged 6 commits into from
Apr 17, 2023

Conversation

natolambert
Copy link
Contributor

@natolambert natolambert commented Apr 10, 2023

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Apr 10, 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.

Thanks for adding this @natolambert! Generally looks good, added two comments.

@@ -73,6 +73,10 @@ class PPOConfig(object):
"help": "Log with either 'wandb' or 'tensorboard', check https://huggingface.co/docs/accelerate/usage_guides/tracking for more details"
},
)
log_token_distribution: Optional[bool] = field(
Copy link
Member

Choose a reason for hiding this comment

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

I would not add another config and just always log it. It's cheap to do.

stats["tokens/query_len_mean"] = torch.mean(query_lens).cpu().numpy().item()
stats["tokens/query_len_std"] = torch.std(query_lens).cpu().numpy().item()
stats["tokens/responses_len_mean"] = torch.mean(response_lens).cpu().numpy().item()
stats["tokens/responses_len_std"] = torch.std(response_lens).cpu().numpy().item()
Copy link
Member

Choose a reason for hiding this comment

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

similar to rewards i would also log the distribution so we can look at histograms in the logs.

@natolambert
Copy link
Contributor Author

KK should be good, example here: https://wandb.ai/huggingface/trl/runs/r2w2101u?workspace=user-natolambert

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.

Thanks, looks good to me!

Copy link
Collaborator

@younesbelkada younesbelkada left a comment

Choose a reason for hiding this comment

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

LGTM!

@younesbelkada younesbelkada merged commit ce37ead into main Apr 17, 2023
11 checks passed
@younesbelkada younesbelkada deleted the log_tokens branch April 17, 2023 15:49
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.

None yet

4 participants