Skip to content

Commit 0d9e2a2

Browse files
SylarTiaNIIDesmonDay
authored andcommitted
[LLM] relocate tensor_parallel_output to avoid conflict (PaddlePaddle#8419)
1 parent 4d33655 commit 0d9e2a2

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

llm/finetune_generation.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import sys
1717
from dataclasses import dataclass, field
1818
from functools import partial
19+
from typing import Optional
1920

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

7075

7176
def read_local_dataset(path):

llm/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def prediction_step(
212212
if isinstance(logits, (list, tuple)):
213213
logits = logits[0]
214214
# all gather logits when enabling tensor_parallel_output
215-
if self.args.tensor_parallel_degree > 1 and self.args.tensor_parallel_output:
215+
if self.args.tensor_parallel_degree > 1 and getattr(self.args, "tensor_parallel_output", False):
216216
hcg = fleet.get_hybrid_communicate_group()
217217
model_parallel_group = hcg.get_model_parallel_group()
218218
gathered_logits = []

paddlenlp/trainer/training_args.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -787,10 +787,6 @@ class TrainingArguments:
787787
default=False,
788788
metadata={"help": "whether to run distributed training in auto parallel mode"},
789789
)
790-
tensor_parallel_output: Optional[bool] = field(
791-
default=False,
792-
metadata={"help": "whether to output logits in distributed status"},
793-
)
794790
use_expert_parallel: Optional[bool] = field(
795791
default=False,
796792
metadata={"help": "Enable MoE (Mixture of Experts) expert parallel training"},

0 commit comments

Comments
 (0)