Scripts Utilities

ScriptArguments

class trl.ScriptArguments

< >

( dataset_name: str dataset_train_split: str = 'train' dataset_test_split: str = 'test' config: typing.Optional[str] = None gradient_checkpointing_use_reentrant: bool = False ignore_bias_buffers: bool = False )

Parameters

  • dataset_name (str) — Dataset name.
  • dataset_train_split (str, optional, defaults to "train") — Dataset split to use for training.
  • dataset_test_split (str, optional, defaults to "test") — Dataset split to use for evaluation.
  • config (str or None, optional, defaults to None) — Path to the optional config file.
  • gradient_checkpointing_use_reentrant (bool, optional, defaults to False) — Whether to apply use_reentrant for gradient_checkpointing.
  • ignore_bias_buffers (bool, optional, defaults to False) — Debug argument for distributed training. Fix for DDP issues with LM bias/mask buffers - invalid scalar type, inplace operation. See https://github.com/huggingface/transformers/issues/22482#issuecomment-1595790992.

Arguments common to all scripts.

TrlParser

class trl.TrlParser

< >

( parsers ignore_extra_args = False )

Parameters

  • parsers (List[argparse.ArgumentParser]) — List of parsers.
  • ignore_extra_args (bool) — Whether to ignore extra arguments passed by the config and not raise errors.

The TRL parser parses a list of parsers (TrainingArguments, trl.ModelConfig, etc.), creates a config parsers for users that pass a valid config field and merge the values that are set in the config with the processed parsers.

parse_args_and_config

< >

( return_remaining_strings = False )

Parse the command line arguments and the config file.

post_process_dataclasses

< >

( dataclasses )

Post process dataclasses to merge the TrainingArguments with the SFTScriptArguments or DPOScriptArguments.

set_defaults_with_config

< >

( **kwargs )

Defaults we’re setting with config allow us to change to required = False

< > Update on GitHub