Skip to content

Commit 19f9b9e

Browse files
Add missing doc strings in SFTrainer (#4003)
Co-authored-by: Quentin Gallouédec <[email protected]> Co-authored-by: Quentin Gallouédec <[email protected]>
1 parent 1eb3801 commit 19f9b9e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

trl/trainer/sft_trainer.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,16 @@ class SFTTrainer(Trainer):
523523
Processing class used to process the data. If `None`, the processing class is loaded from the model's name
524524
with [`~transformers.AutoProcessor.from_pretrained`]. A padding token, `tokenizer.pad_token`, must be set.
525525
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.
526536
callbacks (list of [`~transformers.TrainerCallback`], *optional*, defaults to `None`):
527537
List of callbacks to customize the training loop. Will add those to the list of default callbacks detailed
528538
in [here](https://huggingface.co/docs/transformers/main_classes/callback).

0 commit comments

Comments
 (0)