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

[LLM] relocate tensor_parallel_output to avoid conflict (#8419) #8533

Merged
merged 1 commit into from
Jun 3, 2024
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
[LLM] relocate tensor_parallel_output to avoid conflict (#8419)
SylarTiaNII authored and DesmonDay committed Jun 3, 2024
commit 0d9e2a2a3ca997e3969f8e4456af597b9aa21413
5 changes: 5 additions & 0 deletions llm/finetune_generation.py
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
import sys
from dataclasses import dataclass, field
from functools import partial
from typing import Optional

import paddle
from argument import (
@@ -66,6 +67,10 @@ class FinetuneArguments(TrainingArguments):
default=0,
metadata={"help": "The steps use to control the learing rate."},
)
tensor_parallel_output: Optional[bool] = field(
default=False,
metadata={"help": "whether to output logits in distributed status"},
)


def read_local_dataset(path):
2 changes: 1 addition & 1 deletion llm/utils.py
Original file line number Diff line number Diff line change
@@ -212,7 +212,7 @@ def prediction_step(
if isinstance(logits, (list, tuple)):
logits = logits[0]
# all gather logits when enabling tensor_parallel_output
if self.args.tensor_parallel_degree > 1 and self.args.tensor_parallel_output:
if self.args.tensor_parallel_degree > 1 and getattr(self.args, "tensor_parallel_output", False):
hcg = fleet.get_hybrid_communicate_group()
model_parallel_group = hcg.get_model_parallel_group()
gathered_logits = []
4 changes: 0 additions & 4 deletions paddlenlp/trainer/training_args.py
Original file line number Diff line number Diff line change
@@ -787,10 +787,6 @@ class TrainingArguments:
default=False,
metadata={"help": "whether to run distributed training in auto parallel mode"},
)
tensor_parallel_output: Optional[bool] = field(
default=False,
metadata={"help": "whether to output logits in distributed status"},
)
use_expert_parallel: Optional[bool] = field(
default=False,
metadata={"help": "Enable MoE (Mixture of Experts) expert parallel training"},