-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[llm]support dpo pp #9039
[llm]support dpo pp #9039
Conversation
Thanks for your contribution! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #9039 +/- ##
===========================================
- Coverage 53.26% 53.07% -0.20%
===========================================
Files 652 656 +4
Lines 105607 106095 +488
===========================================
+ Hits 56254 56309 +55
- Misses 49353 49786 +433 ☔ View full report in Codecov by Sentry. |
for key in batch.keys(): | ||
if key not in "response_indexs": | ||
concatenated_inputs[key] = [ | ||
batch[key][i * per_device_train_batch_size : (i + 1) * per_device_train_batch_size] | ||
for i in range(gradient_accumulation_steps) | ||
] | ||
else: | ||
concatenated_inputs["response_indexs"] = [[] for _ in range(gradient_accumulation_steps)] | ||
for i in range(gradient_accumulation_steps): | ||
for response_index in batch[key]: | ||
if response_index[0] in list( | ||
range(i * per_device_train_batch_size, (i + 1) * per_device_train_batch_size) | ||
): | ||
response_index[0] -= i * per_device_train_batch_size | ||
concatenated_inputs["response_indexs"][i].append(response_index) | ||
concatenated_inputs["response_indexs"][i] = paddle.stack(concatenated_inputs["response_indexs"][i]) | ||
if model._layers.config.use_sparse_head_and_loss_fn: | ||
last_batch_response_length = concatenated_inputs["response_indexs"][i][0, 1] | ||
concatenated_inputs["response_indexs"][i][:, 1:] -= last_batch_response_length | ||
|
||
concatenated_inputs["reference_chosen_logps"] = None | ||
concatenated_inputs["reference_rejected_logps"] = None | ||
|
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.
建议这一大堆,封装成一个函数。
get_last_checkpoint, | ||
set_seed, | ||
from dpo_argument import ( | ||
DPOConfig, |
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.
DPOConfig,DPOTrainingArguments
这些看是否加到主repo?
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.
LGTM
PR types
New features
PR changes
APIs
Description