仅仅训练最后一轮对话

This commit is contained in:
Shiyu Zhang
2024-07-18 15:30:25 +08:00
parent beec77a089
commit 1e7b396ff2
6 changed files with 30 additions and 3 deletions

View File

@@ -41,6 +41,10 @@ class DataArguments:
default="data",
metadata={"help": "Path to the folder containing the datasets."},
)
train_last_turn_only: Optional[bool] = field(
default=False,
metadata={"help": "Whether or not to train the last turn only."},
)
cutoff_len: int = field(
default=1024,
metadata={"help": "The cutoff length of the tokenized inputs in the dataset."},

View File

@@ -162,6 +162,9 @@ def get_train_args(args: Optional[Dict[str, Any]] = None) -> _TRAIN_CLS:
# Check arguments
if finetuning_args.stage != "pt" and data_args.template is None:
raise ValueError("Please specify which `template` to use.")
if finetuning_args.stage == "pt" and data_args.train_last_turn_only:
raise ValueError("PT stage does not support `train_last_turn_only`.")
if finetuning_args.stage != "sft" and training_args.predict_with_generate:
raise ValueError("`predict_with_generate` cannot be set as True except SFT.")