-
Notifications
You must be signed in to change notification settings - Fork 391
fix: skip loading reference model when KL penalty is zero #2178
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -554,6 +554,8 @@ def init_train_dataloader(dataset, suffix: str = ""): | |||||||||||||
| policy_config["megatron_cfg"]["train_iters"] = total_train_iters | ||||||||||||||
|
|
||||||||||||||
| # Define initialization functions that will be used in all paths | ||||||||||||||
| init_reference_model = master_config["loss_fn"]["reference_policy_kl_penalty"] > 0 | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BUG: Setting When Multiple existing configs are affected:
All have Suggested fix — auto-derive the skip flag:
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| def init_policy(): | ||||||||||||||
| """Initialize policy training workers.""" | ||||||||||||||
| t0 = time.perf_counter() | ||||||||||||||
|
|
@@ -565,6 +567,7 @@ def init_policy(): | |||||||||||||
| weights_path=weights_path, | ||||||||||||||
| optimizer_path=optimizer_path, | ||||||||||||||
| init_optimizer=True, | ||||||||||||||
| init_reference_model=init_reference_model, | ||||||||||||||
| ) | ||||||||||||||
| return p, time.perf_counter() - t0 | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we set
skip_reference_policy_logprobs_calculationto True in this situation? otherwise I guess we will get error when callingget_reference_policy_logprobs.and I think it's better to add a functional test (or modify one exist functional test) for
reference_policy_kl_penalty == 0.