Skip to content

Commit 21cfd83

Browse files
committed
[LLM] relocate tensor_parallel_output to avoid conflict
1 parent c6e5459 commit 21cfd83

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
@@ -803,10 +803,6 @@ class TrainingArguments:
803803
default=False,
804804
metadata={"help": "whether to run distributed training in auto parallel mode"},
805805
)
806-
tensor_parallel_output: Optional[bool] = field(
807-
default=False,
808-
metadata={"help": "whether to output logits in distributed status"},
809-
)
810806

811807
def __post_init__(self):
812808
env_local_rank = int(os.environ.get("PADDLE_RANK_IN_NODE", -1))

0 commit comments

Comments
 (0)