MCPcopy Create free account
hub / github.com/ModalityDance/Omni-R1 / TrainingArguments

Class TrainingArguments

src/transformers/src/transformers/training_args.py:215–3025  ·  view source on GitHub ↗

TrainingArguments is the subset of the arguments we use in our example scripts **which relate to the training loop itself**. Using [`HfArgumentParser`] we can turn this class into [argparse](https://docs.python.org/3/library/argparse#module-argparse) arguments that can be specified

Source from the content-addressed store, hash-verified

213# TODO: `TrainingArguments` users rely on it being fully mutable. In the future see if we can narrow this to a few keys: https://github.com/huggingface/transformers/pull/25903
214@dataclass
215class TrainingArguments:
216 """
217 TrainingArguments is the subset of the arguments we use in our example scripts **which relate to the training loop
218 itself**.
219
220 Using [`HfArgumentParser`] we can turn this class into
221 [argparse](https://docs.python.org/3/library/argparse#module-argparse) arguments that can be specified on the
222 command line.
223
224 Parameters:
225 output_dir (`str`):
226 The output directory where the model predictions and checkpoints will be written.
227 overwrite_output_dir (`bool`, *optional*, defaults to `False`):
228 If `True`, overwrite the content of the output directory. Use this to continue training if `output_dir`
229 points to a checkpoint directory.
230 do_train (`bool`, *optional*, defaults to `False`):
231 Whether to run training or not. This argument is not directly used by [`Trainer`], it's intended to be used
232 by your training/evaluation scripts instead. See the [example
233 scripts](https://github.com/huggingface/transformers/tree/main/examples) for more details.
234 do_eval (`bool`, *optional*):
235 Whether to run evaluation on the validation set or not. Will be set to `True` if `eval_strategy` is
236 different from `"no"`. This argument is not directly used by [`Trainer`], it's intended to be used by your
237 training/evaluation scripts instead. See the [example
238 scripts](https://github.com/huggingface/transformers/tree/main/examples) for more details.
239 do_predict (`bool`, *optional*, defaults to `False`):
240 Whether to run predictions on the test set or not. This argument is not directly used by [`Trainer`], it's
241 intended to be used by your training/evaluation scripts instead. See the [example
242 scripts](https://github.com/huggingface/transformers/tree/main/examples) for more details.
243 eval_strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"no"`):
244 The evaluation strategy to adopt during training. Possible values are:
245
246 - `"no"`: No evaluation is done during training.
247 - `"steps"`: Evaluation is done (and logged) every `eval_steps`.
248 - `"epoch"`: Evaluation is done at the end of each epoch.
249
250 prediction_loss_only (`bool`, *optional*, defaults to `False`):
251 When performing evaluation and generating predictions, only returns the loss.
252 per_device_train_batch_size (`int`, *optional*, defaults to 8):
253 The batch size per GPU/XPU/TPU/MPS/NPU core/CPU for training.
254 per_device_eval_batch_size (`int`, *optional*, defaults to 8):
255 The batch size per GPU/XPU/TPU/MPS/NPU core/CPU for evaluation.
256 gradient_accumulation_steps (`int`, *optional*, defaults to 1):
257 Number of updates steps to accumulate the gradients for, before performing a backward/update pass.
258
259 <Tip warning={true}>
260
261 When using gradient accumulation, one step is counted as one step with backward pass. Therefore, logging,
262 evaluation, save will be conducted every `gradient_accumulation_steps * xxx_step` training examples.
263
264 </Tip>
265
266 eval_accumulation_steps (`int`, *optional*):
267 Number of predictions steps to accumulate the output tensors for, before moving the results to the CPU. If
268 left unset, the whole predictions are accumulated on GPU/NPU/TPU before being moved to the CPU (faster but
269 requires more memory).
270 eval_delay (`float`, *optional*):
271 Number of epochs or steps to wait for before the first evaluation can be performed, depending on the
272 eval_strategy.

Callers 15

setUpMethod · 0.90
test_model_initMethod · 0.90
test_custom_optimizerMethod · 0.90
setUpMethod · 0.90

Calls 2

is_torch_availableFunction · 0.85
keysMethod · 0.45

Tested by 15

setUpMethod · 0.72
test_model_initMethod · 0.72
test_custom_optimizerMethod · 0.72
setUpMethod · 0.72