Skip to content

Commit

Permalink
[LLM] relocate tensor_parallel_output to avoid conflict (#8419)
Browse files Browse the repository at this point in the history
  • Loading branch information
SylarTiaNII committed May 11, 2024
1 parent 29d40e2 commit f27fdb4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 5 additions & 0 deletions llm/finetune_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import sys
from dataclasses import dataclass, field
from functools import partial
from typing import Optional

import paddle
from argument import (
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion llm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
4 changes: 0 additions & 4 deletions paddlenlp/trainer/training_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,10 +803,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"},
)

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

0 comments on commit f27fdb4

Please sign in to comment.