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] fix sharding stage1 allgather overlap bug, which needs to forbiden pin memory #8594

Merged
Merged
Changes from 3 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: 9 additions & 0 deletions llm/run_pretrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from typing import List, Optional

import paddle
from paddle.io.reader import use_pinned_memory

from paddlenlp.data.causal_dataset import (
build_train_valid_test_datasets,
Expand Down Expand Up @@ -498,6 +499,14 @@ def main():
config.seq_length % config.context_parallel_degree == 0
), f"seq_length:{config.seq_length} must be divisible by context_parallel_degree {config.context_parallel_degree}"

if training_args.sharding_parallel_config is not None:
# for stage1 overlap optimization
if (
"enable_stage1_allgather_overlap" in training_args.sharding_parallel_config
or "enable_stage1_broadcast_overlap" in training_args.sharding_parallel_config
):
Copy link
Collaborator

Choose a reason for hiding this comment

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

from paddle.io.reader import use_pinned_memory

import 也改到这里吧

use_pinned_memory(False)

if get_env_device() == "xpu" and training_args.gradient_accumulation_steps > 1:
try:
from paddle_xpu.layers.nn.linear import LinearConfig # noqa: F401
Expand Down
Loading