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
Copy file name to clipboardExpand all lines: trl/trainer/sft_trainer.py
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -523,6 +523,16 @@ class SFTTrainer(Trainer):
523
523
Processing class used to process the data. If `None`, the processing class is loaded from the model's name
524
524
with [`~transformers.AutoProcessor.from_pretrained`]. A padding token, `tokenizer.pad_token`, must be set.
525
525
If the processing class has not set a padding token, `tokenizer.eos_token` will be used as the default.
526
+
compute_loss_func (`Callable` or `None`, *optional*, defaults to `None`):
527
+
A function that accepts the raw model outputs, labels, and the number of items in the entire accumulated
528
+
batch (batch_size * gradient_accumulation_steps) and returns the loss. For example, see the default [loss function](https://github.com/huggingface/transformers/blob/052e652d6d53c2b26ffde87e039b723949a53493/src/transformers/trainer.py#L3618) used by [`Trainer`].
529
+
compute_metrics (`Callable[[EvalPrediction], dict]` or `None`, *optional*, defaults to `None`):
530
+
The function that will be used to compute metrics at evaluation. Must take a
531
+
[`~transformers.EvalPrediction`] and return a dictionary string to metric values. When passing
532
+
[`SFTConfig`] with `batch_eval_metrics` set to `True`, your `compute_metrics` function must take a boolean
533
+
`compute_result` argument. This will be triggered after the last eval batch to signal that the function
534
+
needs to calculate and return the global summary statistics rather than accumulating the batch-level
535
+
statistics.
526
536
callbacks (list of [`~transformers.TrainerCallback`], *optional*, defaults to `None`):
527
537
List of callbacks to customize the training loop. Will add those to the list of default callbacks detailed
528
538
in [here](https://huggingface.co/docs/transformers/main_classes/callback).
0 commit comments