Skip to content

Commit 5926c30

Browse files
authored
[Refactor] SFTTrainer SFTConfig (#9318)
* refactor * fix import.
1 parent cbe5af1 commit 5926c30

File tree

19 files changed

+690
-668
lines changed

19 files changed

+690
-668
lines changed

llm/alignment/dpo/dpo_argument.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,7 @@
1818

1919
from paddlenlp.trainer import TrainingArguments
2020
from paddlenlp.trainer.trainer_utils import IntervalStrategy
21-
22-
23-
def add_start_docstrings(*docstr):
24-
"""Adds docstrings for a function."""
25-
26-
def docstring_decorator(fn):
27-
fn.__doc__ = "".join(docstr) + (fn.__doc__ if fn.__doc__ is not None else "")
28-
return fn
29-
30-
return docstring_decorator
21+
from paddlenlp.trainer.utils.doc import add_start_docstrings
3122

3223

3324
@dataclass

llm/alignment/rm/flashmask/reward_argument.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,7 @@
1717
from typing import Optional
1818

1919
from paddlenlp.trainer import TrainingArguments
20-
21-
22-
def add_start_docstrings(*docstr):
23-
"""Adds docstrings for a function."""
24-
25-
def docstring_decorator(fn):
26-
fn.__doc__ = "".join(docstr) + (fn.__doc__ if fn.__doc__ is not None else "")
27-
return fn
28-
29-
return docstring_decorator
20+
from paddlenlp.trainer.utils.doc import add_start_docstrings
3021

3122

3223
@dataclass

llm/auto_parallel/gpt-3/run_pretrain_auto.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,7 @@
5252
check_data_split,
5353
print_rank_0,
5454
)
55-
56-
57-
def add_start_docstrings(*docstr):
58-
def docstring_decorator(fn):
59-
fn.__doc__ = "".join(docstr) + (fn.__doc__ if fn.__doc__ is not None else "")
60-
return fn
61-
62-
return docstring_decorator
55+
from paddlenlp.trainer.utils.doc import add_start_docstrings
6356

6457

6558
@dataclass

llm/auto_parallel/llama/run_pretrain_auto.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,7 @@
5555
check_data_split,
5656
print_rank_0,
5757
)
58-
59-
60-
def add_start_docstrings(*docstr):
61-
def docstring_decorator(fn):
62-
fn.__doc__ = "".join(docstr) + (fn.__doc__ if fn.__doc__ is not None else "")
63-
return fn
64-
65-
return docstring_decorator
58+
from paddlenlp.trainer.utils.doc import add_start_docstrings
6659

6760

6861
@dataclass

llm/auto_parallel/qwen/run_pretrain_3D_auto.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,7 @@
5353
check_data_split,
5454
print_rank_0,
5555
)
56-
57-
58-
def add_start_docstrings(*docstr):
59-
def docstring_decorator(fn):
60-
fn.__doc__ = "".join(docstr) + (fn.__doc__ if fn.__doc__ is not None else "")
61-
return fn
62-
63-
return docstring_decorator
56+
from paddlenlp.trainer.utils.doc import add_start_docstrings
6457

6558

6659
@dataclass

llm/experimental/ernie-3.5-se/run_pretrain.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,7 @@
4949
}
5050

5151

52-
def add_start_docstrings(*docstr):
53-
def docstring_decorator(fn):
54-
fn.__doc__ = "".join(docstr) + (fn.__doc__ if fn.__doc__ is not None else "")
55-
return fn
56-
57-
return docstring_decorator
52+
from paddlenlp.trainer.utils.doc import add_start_docstrings
5853

5954

6055
@dataclass

0 commit comments

Comments
 (0)