-
Notifications
You must be signed in to change notification settings - Fork 3k
[RL] Refoctor code and add comments #10565
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
base: develop
Are you sure you want to change the base?
[RL] Refoctor code and add comments #10565
Conversation
Thanks for your contribution! |
paddlenlp/rl/utils/reshard_utils.py
Outdated
@@ -140,6 +191,24 @@ def mp_reshard( | |||
|
|||
|
|||
def init_reshard_mappings(model, training_args, pp_rank, pp_group): | |||
""" | |||
初始化重新分片映射,并返回全局的元数据字典。如果模型是在多个水平并行度下训练,则会设置管道名称映射。 |
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.
是不是统一用英文比较好?
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.
Done
Codecov ReportAttention: Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #10565 +/- ##
===========================================
- Coverage 46.98% 46.97% -0.02%
===========================================
Files 799 799
Lines 132246 132282 +36
===========================================
- Hits 62135 62133 -2
- Misses 70111 70149 +38 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
if not isinstance(arg_name_values, list) and not isinstance(args, list): | ||
arg_name_values = [arg_name_values] | ||
args = [args] | ||
elif isinstance(arg_name_values, list) and isinstance(args, list): | ||
pass | ||
else: | ||
raise ValueError("args and arg_name_values should be both list or both not list") | ||
|
||
for i in range(len(args)): | ||
for k, v in arg_name_values[i].items(): | ||
old_value = getattr(args[i], k, None) | ||
setattr(args[i], k, v) | ||
arg_name_values[i][k] = old_value | ||
yield | ||
for k, v in arg_name_values.items(): | ||
old_value = getattr(args, k) | ||
setattr(args, k, v) | ||
arg_name_values[k] = old_value | ||
for i in range(len(args)): | ||
for k, v in arg_name_values[i].items(): | ||
old_value = getattr(args[i], k) | ||
setattr(args[i], k, v) | ||
arg_name_values[i][k] = old_value |
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.
支持list传入
…nFish19/PaddleNLP into dev_20250506_add_comment_rl
Before submitting
tests
folder. If there are codecov issues, please add tests cases first.PR types
Others
PR changes
Docs
Description
Refoctor code (with minimal changes) and add comments.