Skip to content

Commit

Permalink
[Refactor] SFTTrainer SFTConfig (PaddlePaddle#9318)
Browse files Browse the repository at this point in the history
* refactor

* fix import.
  • Loading branch information
ZHUI authored Nov 28, 2024
1 parent cbe5af1 commit 5926c30
Show file tree
Hide file tree
Showing 19 changed files with 690 additions and 668 deletions.
11 changes: 1 addition & 10 deletions llm/alignment/dpo/dpo_argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,7 @@

from paddlenlp.trainer import TrainingArguments
from paddlenlp.trainer.trainer_utils import IntervalStrategy


def add_start_docstrings(*docstr):
"""Adds docstrings for a function."""

def docstring_decorator(fn):
fn.__doc__ = "".join(docstr) + (fn.__doc__ if fn.__doc__ is not None else "")
return fn

return docstring_decorator
from paddlenlp.trainer.utils.doc import add_start_docstrings


@dataclass
Expand Down
11 changes: 1 addition & 10 deletions llm/alignment/rm/flashmask/reward_argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,7 @@
from typing import Optional

from paddlenlp.trainer import TrainingArguments


def add_start_docstrings(*docstr):
"""Adds docstrings for a function."""

def docstring_decorator(fn):
fn.__doc__ = "".join(docstr) + (fn.__doc__ if fn.__doc__ is not None else "")
return fn

return docstring_decorator
from paddlenlp.trainer.utils.doc import add_start_docstrings


@dataclass
Expand Down
9 changes: 1 addition & 8 deletions llm/auto_parallel/gpt-3/run_pretrain_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,7 @@
check_data_split,
print_rank_0,
)


def add_start_docstrings(*docstr):
def docstring_decorator(fn):
fn.__doc__ = "".join(docstr) + (fn.__doc__ if fn.__doc__ is not None else "")
return fn

return docstring_decorator
from paddlenlp.trainer.utils.doc import add_start_docstrings


@dataclass
Expand Down
9 changes: 1 addition & 8 deletions llm/auto_parallel/llama/run_pretrain_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,7 @@
check_data_split,
print_rank_0,
)


def add_start_docstrings(*docstr):
def docstring_decorator(fn):
fn.__doc__ = "".join(docstr) + (fn.__doc__ if fn.__doc__ is not None else "")
return fn

return docstring_decorator
from paddlenlp.trainer.utils.doc import add_start_docstrings


@dataclass
Expand Down
9 changes: 1 addition & 8 deletions llm/auto_parallel/qwen/run_pretrain_3D_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,7 @@
check_data_split,
print_rank_0,
)


def add_start_docstrings(*docstr):
def docstring_decorator(fn):
fn.__doc__ = "".join(docstr) + (fn.__doc__ if fn.__doc__ is not None else "")
return fn

return docstring_decorator
from paddlenlp.trainer.utils.doc import add_start_docstrings


@dataclass
Expand Down
7 changes: 1 addition & 6 deletions llm/experimental/ernie-3.5-se/run_pretrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@
}


def add_start_docstrings(*docstr):
def docstring_decorator(fn):
fn.__doc__ = "".join(docstr) + (fn.__doc__ if fn.__doc__ is not None else "")
return fn

return docstring_decorator
from paddlenlp.trainer.utils.doc import add_start_docstrings


@dataclass
Expand Down
Loading

0 comments on commit 5926c30

Please sign in to comment.