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 authored and DesmonDay committed Jun 3, 2024
1 parent 4d33655 commit 4fc6c21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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

0 comments on commit 4fc6c21

Please sign in to comment.