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

Update set_seed in trainer_utils.py #7528

Merged
merged 8 commits into from
Dec 5, 2023

Conversation

AnnaTrainingG
Copy link
Contributor

@AnnaTrainingG AnnaTrainingG commented Nov 27, 2023

PR types

Others

PR changes

Others

Description

修复PP分布式策略下 多卡之前seed设置错误的问题

Copy link

paddle-bot bot commented Nov 27, 2023

Thanks for your contribution!

ZHUI
ZHUI previously approved these changes Nov 27, 2023
Copy link
Collaborator

@ZHUI ZHUI left a comment

Choose a reason for hiding this comment

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

LGTM

@ZHUI
Copy link
Collaborator

ZHUI commented Nov 27, 2023

Copy link

codecov bot commented Dec 4, 2023

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (be318c5) 57.92% compared to head (e122535) 57.86%.
Report is 15 commits behind head on develop.

Files Patch % Lines
paddlenlp/trainer/trainer_utils.py 75.00% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7528      +/-   ##
===========================================
- Coverage    57.92%   57.86%   -0.06%     
===========================================
  Files          579      582       +3     
  Lines        86390    86492     +102     
===========================================
+ Hits         50038    50046       +8     
- Misses       36352    36446      +94     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AnnaTrainingG AnnaTrainingG changed the title Update trainer_utils.py Update set_seed in trainer_utils.py Dec 4, 2023
Comment on lines 356 to 362
init_dist_env(
training_args.tensor_parallel_degree,
training_args.sharding_parallel_degree,
training_args.pipeline_parallel_degree,
training_args.data_parallel_degree,
training_args.seed,
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个环境已经在 training_args 里面初始化好了。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已经删除

"""

# set control in tensor parallel
print("init_dist_env asdfasdfasdf niuliling")
Copy link
Collaborator

Choose a reason for hiding this comment

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

测试的flag 删除

Copy link
Contributor Author

Choose a reason for hiding this comment

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

完成

ZHUI
ZHUI previously approved these changes Dec 4, 2023
Copy link
Collaborator

@ZHUI ZHUI left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@ZHUI ZHUI left a comment

Choose a reason for hiding this comment

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

LGTM

if args.use_hybrid_parallel:
from paddle.distributed.fleet.meta_parallel import get_rng_state_tracker
else:
hcg = fleet.get_hybrid_communicate_group() if hasattr(fleet.fleet, "_hcg") else None
Copy link
Collaborator

Choose a reason for hiding this comment

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

hasattr(fleet.fleet, "_hcg") 这个属性是初始化分布式了之后才有?

  1. cpu版本paddle
  2. gpu版本paddle 跑cpu
  3. gpu版本跑gpu

2的情况下fleet.fleet._hcg是否是None。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是的init之后才有hcg 或者init_dist_env之后才有hcg
2的时候不是none, 当未初始化的时候才是none

@ZHUI ZHUI merged commit f3607d5 into PaddlePaddle:develop Dec 5, 2023
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.

2 participants