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

add recomptue interval for pp #860

Merged
Merged
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
9 changes: 7 additions & 2 deletions ppfleetx/models/language_model/gpt/dygraph/hybrid_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,8 @@ def __init__(self,
recompute_granularity="full",
virtual_pp_degree=1,
sequence_parallel=False,
no_recompute_layers=None):
no_recompute_layers=None,
pp_recompute_interval=1):

# forward desc
self.descs = []
Expand Down Expand Up @@ -1057,7 +1058,11 @@ def _logits_helper(embedding, output):

recompute_interval = 0
if recompute and recompute_granularity == "full":
recompute_interval = 1
assert pp_recompute_interval <= \
num_layers // (virtual_pp_degree *
fleet.get_hybrid_communicate_group().topology().get_dim_size("pipe")), \
"pp recompute interval should smaller than num layers of each pp chunk"
recompute_interval = pp_recompute_interval

super().__init__(
layers=self.descs,
Expand Down
1 change: 1 addition & 0 deletions ppfleetx/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def process_dist_config(configs):

mp_degree = config.setdefault("mp_degree", 1)
pp_degree = config.setdefault("pp_degree", 1)
pp_recompute_interval = config.setdefault("pp_recompute_interval", 1)

# sharding default
sharding_config = config['sharding']
Expand Down