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

Bug Fix, to fix pp sp layernorm grad sync #7613

Merged
merged 3 commits into from
Dec 12, 2023
Merged
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
8 changes: 7 additions & 1 deletion paddlenlp/transformers/gpt/modeling_pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
from paddle.distributed.fleet.utils import recompute

from paddlenlp.transformers.model_utils import PipelinePretrainedModel
from paddlenlp.transformers.sequence_parallel_utils import GatherOp
from paddlenlp.transformers.sequence_parallel_utils import (
GatherOp,
mark_as_sequence_parallel_parameter,
)

from .modeling import (
GPTConfig,
Expand Down Expand Up @@ -128,6 +131,9 @@
class LayerNormPipe(nn.LayerNorm):
def __init__(self, config):
super(LayerNormPipe, self).__init__(config.hidden_size, epsilon=1e-05)
if config.sequence_parallel:
mark_as_sequence_parallel_parameter(self.weight)
mark_as_sequence_parallel_parameter(self.bias)

Check warning on line 136 in paddlenlp/transformers/gpt/modeling_pp.py

View check run for this annotation

Codecov / codecov/patch

paddlenlp/transformers/gpt/modeling_pp.py#L134-L136

Added lines #L134 - L136 were not covered by tests

def forward(self, args):
hidden_states, attention_mask, position_ids = parse_args(args)
Expand Down