You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"TRL is a library to post-train LLMs and diffusion models with methods such as Supervised Fine-tuning (SFT), Proximal Policy Optimization (PPO), and Direct Preference Optimization (DPO)."
Copy file name to clipboardExpand all lines: trl/trainer/sft_trainer.py
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -367,7 +367,11 @@ def _prepare_dataset(
367
367
"You passed a dataset that is already processed (contains an `input_ids` field) together with a valid formatting function. Therefore `formatting_func` will be ignored."
368
368
)
369
369
370
-
returndataset
370
+
defformatting_func(x):
371
+
returnx["input_ids"]
372
+
373
+
ifnotpacking:
374
+
returndataset
371
375
372
376
# check if torch dataset / dataloader and do nothing
373
377
# see https://github.com/huggingface/trl/pull/1468 for why datasets.IterableDataset needs a separate check
0 commit comments