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

Fix wrong argument bug in PPOv2Trainer #1660

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion trl/trainer/ppov2_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


@dataclass
class PPOv2Config(TrainingArguments, OnpolicyRuntimeConfig):
class PPOv2Config(OnpolicyRuntimeConfig, TrainingArguments):
# common config
exp_name: str = os.path.basename(__file__)[: -len(".py")]
"""the name of this experiment"""
Expand Down
4 changes: 2 additions & 2 deletions trl/trainer/ppov2_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def repeat_generator():
query_response, logits = generate(
unwrapped_model.policy,
query,
tokenizer,
tokenizer.pad_token_id,
generation_config,
)
response = query_response[:, context_length:]
Expand Down Expand Up @@ -407,7 +407,7 @@ def repeat_generator():
mb_query_responses = query_responses[micro_batch_inds]
mb_logprobs = logprobs[micro_batch_inds]

output, vpred_temp = forward(model, mb_query_responses, tokenizer)
output, vpred_temp = forward(model, mb_query_responses, tokenizer.pad_token_id)
logits = output.logits[:, context_length - 1 : -1]
logits /= args.temperature + 1e-7
new_all_logprobs = F.log_softmax(logits, dim=-1)
Expand Down
2 changes: 1 addition & 1 deletion trl/trainer/rloo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


@dataclass
class RLOOConfig(TrainingArguments, OnpolicyRuntimeConfig):
class RLOOConfig(OnpolicyRuntimeConfig, TrainingArguments):
# common config
exp_name: str = os.path.basename(__file__)[: -len(".py")]
"""the name of this experiment"""
Expand Down