text stringlengths 1 1.02k | class_index int64 0 10.8k | source stringlengths 85 188 |
|---|---|---|
Instead of `List[float]` you can have tensors (numpy arrays, PyTorch tensors or TensorFlow tensors),
see the note above for the return type.
padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `True`):
Select a strategy to pad the returned sequences ... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
- `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single
sequence if provided).
- `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum
acceptable input length for the model if that ... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability
`>= 7.5` (Volta), or on TPUs which benefit from having sequence lengths be a multiple of 128.
return_attention_mask (`bool`, *optional*):
Whether to return the attention mas... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
- `'tf'`: Return TensorFlow `tf.constant` objects.
- `'pt'`: Return PyTorch `torch.Tensor` objects.
- `'np'`: Return Numpy `np.ndarray` objects.
"""
# If we have a list of dicts, let's convert it in a dict of lists
# We do this to allow using this method as a coll... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
# The model's main input name, usually `input_values`, has be passed for padding
if self.model_input_names[0] not in processed_features:
raise ValueError(
"You should supply an instance of `transformers.BatchFeature` or list of `transformers.BatchFeature`"
f" to this ... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
# If we have PyTorch/TF tensors or lists as inputs, we cast them as Numpy arrays
# and rebuild them afterwards if no return_tensors is specified
# Note that we lose the specific device the tensor may be on for PyTorch
first_element = required_input[0]
if isinstance(first_element, (list,... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
if return_tensors is None:
if is_tf_tensor(first_element):
return_tensors = "tf"
elif is_torch_tensor(first_element):
return_tensors = "pt"
elif isinstance(first_element, (int, float, list, tuple, np.ndarray)):
return_tensors = "np"
... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
required_input = processed_features[self.model_input_names[0]]
batch_size = len(required_input)
if not all(len(v) == batch_size for v in processed_features.values()):
raise ValueError("Some items in the output dictionary have a different batch size than others.")
truncated_inputs =... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
if padding_strategy == PaddingStrategy.LONGEST:
# make sure that `max_length` cannot be longer than the longest truncated length
max_length = max(len(input_slice[self.model_input_names[0]]) for input_slice in truncated_inputs)
padding_strategy = PaddingStrategy.MAX_LENGTH
ba... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
return BatchFeature(batch_outputs, tensor_type=return_tensors)
def _pad(
self,
processed_features: Union[Dict[str, np.ndarray], BatchFeature],
max_length: Optional[int] = None,
padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD,
pad_to_multiple_of: Optional[int] ... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
Args:
processed_features (`Union[Dict[str, np.ndarray], BatchFeature]`):
Dictionary of input values (`np.ndarray[float]`) / input vectors (`List[np.ndarray[float]]`) or batch
of inputs values (`List[np.ndarray[int]]`) / input vectors (`List[np.ndarray[int]]`)
max_... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
- 'left': pads on the left of the sequences
- 'right': pads on the right of the sequences
pad_to_multiple_of (`int`, *optional*):
Integer if set will pad the sequence to a multiple of the provided value. This is especially useful to
enable the use of Tenso... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
if max_length is not None and pad_to_multiple_of is not None and (max_length % pad_to_multiple_of != 0):
max_length = ((max_length // pad_to_multiple_of) + 1) * pad_to_multiple_of
needs_to_be_padded = padding_strategy != PaddingStrategy.DO_NOT_PAD and len(required_input) < max_length
if re... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
if needs_to_be_padded:
difference = max_length - len(required_input)
if self.padding_side == "right":
if return_attention_mask:
processed_features["attention_mask"] = np.pad(
processed_features["attention_mask"], (0, difference)
... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
processed_features[self.model_input_names[0]] = np.pad(
required_input, padding_shape, "constant", constant_values=self.padding_value
)
else:
raise ValueError("Invalid padding strategy:" + str(self.padding_side)) | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
return processed_features
def _truncate(
self,
processed_features: Union[Dict[str, np.ndarray], BatchFeature],
max_length: Optional[int] = None,
pad_to_multiple_of: Optional[int] = None,
truncation: Optional[bool] = None,
):
"""
Truncate inputs to predefi... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
Args:
processed_features(`Union[Dict[str, np.ndarray], BatchFeature]`):
Dictionary of input values (`np.ndarray[float]`) / input vectors (`List[np.ndarray[float]]`) or batch
of inputs values (`List[np.ndarray[int]]`) / input vectors (`List[np.ndarray[int]]`)
max_l... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
return processed_features
elif truncation and max_length is None:
raise ValueError("When setting ``truncation=True``, make sure that ``max_length`` is defined.") | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
required_input = processed_features[self.model_input_names[0]]
# find `max_length` that fits `pad_to_multiple_of`
if max_length is not None and pad_to_multiple_of is not None and (max_length % pad_to_multiple_of != 0):
max_length = ((max_length // pad_to_multiple_of) + 1) * pad_to_multiple_... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
# Get padding strategy
if padding is not False:
if padding is True:
padding_strategy = PaddingStrategy.LONGEST # Default to pad to the longest sequence in the batch
elif not isinstance(padding, PaddingStrategy):
padding_strategy = PaddingStrategy(padding)... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
# Test if we have a padding value
if padding_strategy != PaddingStrategy.DO_NOT_PAD and (self.padding_value is None):
raise ValueError(
"Asking to pad but the feature_extractor does not have a padding value. Please select a value to use"
" as `padding_value`. For exam... | 177 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/feature_extraction_sequence_utils.py |
class OptimizerNames(ExplicitEnum):
"""
Stores the acceptable string identifiers for optimizers.
""" | 178 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
ADAMW_HF = "adamw_hf"
ADAMW_TORCH = "adamw_torch"
ADAMW_TORCH_FUSED = "adamw_torch_fused"
ADAMW_TORCH_XLA = "adamw_torch_xla"
ADAMW_TORCH_NPU_FUSED = "adamw_torch_npu_fused"
ADAMW_APEX_FUSED = "adamw_apex_fused"
ADAFACTOR = "adafactor"
ADAMW_ANYPRECISION = "adamw_anyprecision"
ADAMW_TORC... | 178 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
GALORE_ADAMW_8BIT = "galore_adamw_8bit"
GALORE_ADAFACTOR = "galore_adafactor"
GALORE_ADAMW_LAYERWISE = "galore_adamw_layerwise"
GALORE_ADAMW_8BIT_LAYERWISE = "galore_adamw_8bit_layerwise"
GALORE_ADAFACTOR_LAYERWISE = "galore_adafactor_layerwise"
LOMO = "lomo"
ADALOMO = "adalomo"
GROKADAMW = ... | 178 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
class TrainingArguments:
"""
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 ... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
Parameters:
output_dir (`str`):
The output directory where the model predictions and checkpoints will be written.
overwrite_output_dir (`bool`, *optional*, defaults to `False`):
If `True`, overwrite the content of the output directory. Use this to continue training if `output_dir... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
training/evaluation scripts instead. See the [example
scripts](https://github.com/huggingface/transformers/tree/main/examples) for more details.
do_predict (`bool`, *optional*, defaults to `False`):
Whether to run predictions on the test set or not. This argument is not directly used by ... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
- `"no"`: No evaluation is done during training.
- `"steps"`: Evaluation is done (and logged) every `eval_steps`.
- `"epoch"`: Evaluation is done at the end of each epoch.
prediction_loss_only (`bool`, *optional*, defaults to `False`):
When performing evaluation and ... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
When using gradient accumulation, one step is counted as one step with backward pass. Therefore, logging,
evaluation, save will be conducted every `gradient_accumulation_steps * xxx_step` training examples.
</Tip>
eval_accumulation_steps (`int`, *optional*):
Number of predi... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
This can help avoid CUDA out-of-memory errors by lowering peak VRAM usage at a cost of about [10% slower performance](https://github.com/huggingface/transformers/issues/31372).
</Tip> | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
learning_rate (`float`, *optional*, defaults to 5e-5):
The initial learning rate for [`AdamW`] optimizer.
weight_decay (`float`, *optional*, defaults to 0):
The weight decay to apply (if not zero) to all layers except all bias and LayerNorm weights in [`AdamW`]
optimizer.
... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
the last epoch before stopping training).
max_steps (`int`, *optional*, defaults to -1):
If set to a positive number, the total number of training steps to perform. Overrides `num_train_epochs`.
For a finite dataset, training is reiterated through the dataset (if all data is exhausted) u... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
Number of steps used for a linear warmup from 0 to `learning_rate`. Overrides any effect of `warmup_ratio`.
log_level (`str`, *optional*, defaults to `passive`):
Logger log level to use on the main process. Possible choices are the log levels as strings: 'debug',
'info', 'warning', 'erro... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
*output_dir/runs/**CURRENT_DATETIME_HOSTNAME***.
logging_strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"steps"`):
The logging strategy to adopt during training. Possible values are: | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
- `"no"`: No logging is done during training.
- `"epoch"`: Logging is done at the end of each epoch.
- `"steps"`: Logging is done every `logging_steps`.
logging_first_step (`bool`, *optional*, defaults to `False`):
Whether to log the first `global_step` or not.
... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
`logging_nan_inf_filter` only influences the logging of loss values, it does not change the behavior the
gradient is computed or applied to the model.
</Tip>
save_strategy (`str` or [`~trainer_utils.SaveStrategy`], *optional*, defaults to `"steps"`):
The checkpoint save str... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
If `"epoch"` or `"steps"` is chosen, saving will also be performed at the
very end of training, always.
save_steps (`int` or `float`, *optional*, defaults to 500):
Number of updates steps before two checkpoint saves if `save_strategy="steps"`. Should be an integer or a
fl... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
alongside the best model. When `save_total_limit=1` and `load_best_model_at_end`, it is possible that two
checkpoints are saved: the last one and the best one (if they are different).
save_safetensors (`bool`, *optional*, defaults to `True`):
Use [safetensors](https://huggingface.co/docs... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
This should not be activated when the different nodes use the same storage as the files will be saved with
the same names for each node.
save_only_model (`bool`, *optional*, defaults to `False`):
When checkpointing, whether to only save the model, or also the optimizer, scheduler & rng s... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
Whether or not to use cpu. If set to False, we will use cuda or mps device if available.
seed (`int`, *optional*, defaults to 42):
Random seed that will be set at the beginning of training. To ensure reproducibility across runs, use the
[`~Trainer.model_init`] function to instantiate the... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
bf16 (`bool`, *optional*, defaults to `False`):
Whether to use bf16 16-bit (mixed) precision training instead of 32-bit training. Requires Ampere or higher
NVIDIA architecture or using CPU (use_cpu) or Ascend NPU. This is an experimental API and it may change.
fp16 (`bool`, *optional*, d... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
The backend to use for mixed precision training. Must be one of `"auto", "apex", "cpu_amp"`. `"auto"` will
use CPU/CUDA AMP or APEX depending on the PyTorch version detected, while the other choices will force the
requested backend.
bf16_full_eval (`bool`, *optional*, defaults to `False`... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
the [TF32](https://huggingface.co/docs/transformers/perf_train_gpu_one#tf32) documentation. This is an
experimental API and it may change.
local_rank (`int`, *optional*, defaults to -1):
Rank of the process during distributed training.
ddp_backend (`str`, *optional*):
... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
value as `logging_steps` if not set. Should be an integer or a float in range `[0,1)`. If smaller than 1,
will be interpreted as ratio of total training steps.
dataloader_num_workers (`int`, *optional*, defaults to 0):
Number of subprocesses to use for data loading (PyTorch only). 0 mean... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
[mlflow](https://www.mlflow.org/) and [comet](https://www.comet.com/site) logging. If not specified, will
be the same as `output_dir`.
disable_tqdm (`bool`, *optional*):
Whether or not to disable the tqdm progress bars and table of metrics produced by
[`~notebook.NotebookTrai... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
Will eventually default to the list of argument names accepted by the model that contain the word "label",
except if the model used is one of the `XxxForQuestionAnswering` in which case it will also include the
`["start_positions", "end_positions"]` keys.
load_best_model_at_end (`bool`, ... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
metric_for_best_model (`str`, *optional*):
Use in conjunction with `load_best_model_at_end` to specify the metric to use to compare two different
models. Must be the name of a metric returned by the evaluation with or without the prefix `"eval_"`.
If not specified, this will default... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
- `True` if `metric_for_best_model` is set to a value that doesn't end in `"loss"`.
- `False` if `metric_for_best_model` is not set, or set to a value that ends in `"loss"`.
ignore_data_skip (`bool`, *optional*, defaults to `False`):
When resuming training, whether or not to skip the epo... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
- `"full_shard"`: Shard parameters, gradients and optimizer states.
- `"shard_grad_op"`: Shard optimizer states and gradients.
- `"hybrid_shard"`: Apply `FULL_SHARD` within a node, and replicate parameters across nodes.
- `"hybrid_shard_zero2"`: Apply `SHARD_GRAD_OP` within a node, a... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
A List of config and its options:
- min_num_params (`int`, *optional*, defaults to `0`):
FSDP's minimum number of parameters for Default Auto Wrapping. (useful only when `fsdp` field is
passed).
- transformer_layer_cls_to_wrap (`List[str]`, *option... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
- `"backward_pre"` : Prefetches the next set of parameters before the current set of parameter's
gradient
computation.
- `"backward_post"` : This prefetches the next set of parameters after the current set of
parameter’s
... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
- use_orig_params (`bool`, *optional*, defaults to `True`)
If `"True"`, allows non-uniform `requires_grad` during init, which means support for interspersed
frozen and trainable paramteres. Useful in cases such as parameter-efficient fine-tuning. Please
refer ... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
have empty weights. When this setting as `"True"`, `sync_module_states` also must to be `"True"`,
otherwise all the processes except the main process would have random weights leading to unexpected
behaviour during training.
- activation_checkpointing (`bool`, *o... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
The value is a dictionary which stores the XLA FSDP wrapping parameters. | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
For a complete list of options, please see [here](
https://github.com/pytorch/xla/blob/master/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py).
- xla_fsdp_grad_ckpt (`bool`, *optional*, defaults to `False`):
Will use gradient checkpointing over each ... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
<Tip warning={true}>
If enabling any Zero-init, make sure that your model is not initialized until
*after* initializing the `TrainingArguments`, else it will not be applied.
</Tip>
accelerator_config (`str`, `dict`, or `AcceleratorConfig`, *optional*):
Co... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
A list of config and its options:
- split_batches (`bool`, *optional*, defaults to `False`):
Whether or not the accelerator should split the batches yielded by the dataloaders across the devices. If
`True` the actual batch size used will be the same on any kind of... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
- even_batches (`bool`, *optional*, defaults to `True`):
If set to `True`, in cases where the total batch size across all processes does not exactly divide the
dataset, samples at the start of the dataset will be duplicated so the batch can be divided equally among
... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
Whether or not to use a pre-configured `AcceleratorState` or `PartialState` defined before calling `TrainingArguments`.
If `True`, an `Accelerator` or `PartialState` must be initialized. Note that by doing so, this could lead to issues
with hyperparameter tuning. | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
label_smoothing_factor (`float`, *optional*, defaults to 0.0):
The label smoothing factor to use. Zero means no label smoothing, otherwise the underlying onehot-encoded
labels are changed from 0s and 1s to `label_smoothing_factor/num_labels` and `1 - label_smoothing_factor +
label_sm... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
The options should be separated by whitespaces.
optim (`str` or [`training_args.OptimizerNames`], *optional*, defaults to `"adamw_torch"`):
The optimizer to use, such as "adamw_hf", "adamw_torch", "adamw_torch_fused", "adamw_apex_fused", "adamw_anyprecision",
"adafactor". See `OptimizerN... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
Column name for precomputed lengths. If the column exists, grouping by length will use these values rather
than computing them on train startup. Ignored unless `group_by_length` is `True` and the dataset is an
instance of `Dataset`.
report_to (`str` or `List[str]`, *optional*, defaults t... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
ddp_bucket_cap_mb (`int`, *optional*):
When using distributed training, the value of the flag `bucket_cap_mb` passed to `DistributedDataParallel`.
ddp_broadcast_buffers (`bool`, *optional*):
When using distributed training, the value of the flag `broadcast_buffers` passed to
... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
Number of batches loaded in advance by each worker.
2 means there will be a total of 2 * num_workers batches prefetched across all workers.
skip_memory_metrics (`bool`, *optional*, defaults to `True`):
Whether to skip adding of memory profiler reports to metrics. This is skipped by defau... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
<Tip warning={true}>
If `output_dir` exists, it needs to be a local clone of the repository to which the [`Trainer`] will be
pushed.
</Tip> | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
resume_from_checkpoint (`str`, *optional*):
The path to a folder with a valid checkpoint for your model. This argument is not directly used by
[`Trainer`], it's intended to be used by your training/evaluation scripts instead. See the [example
scripts](https://github.com/huggingface/t... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
Will default to the name of `output_dir`.
hub_strategy (`str` or [`~trainer_utils.HubStrategy`], *optional*, defaults to `"every_save"`):
Defines the scope of what is pushed to the Hub and when. Possible values are: | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
- `"end"`: push the model, its configuration, the processing class e.g. tokenizer (if passed along to the [`Trainer`]) and a
draft of a model card when the [`~Trainer.save_model`] method is called.
- `"every_save"`: push the model, its configuration, the processing class e.g. tokenizer (if pas... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
- `"all_checkpoints"`: like `"checkpoint"` but all checkpoints are pushed like they appear in the output
folder (so you will get one checkpoint folder per folder in your final repository) | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
hub_token (`str`, *optional*):
The token to use to push the model to the Hub. Will default to the token in the cache folder obtained with
`huggingface-cli login`.
hub_private_repo (`bool`, *optional*):
Whether to make the repo private. If `None` (default), the repo will be pu... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
include_inputs_for_metrics (`bool`, *optional*, defaults to `False`):
This argument is deprecated. Use `include_for_metrics` instead, e.g, `include_for_metrics = ["inputs"]`.
include_for_metrics (`List[str]`, *optional*, defaults to `[]`):
Include additional data in the `compute_metrics`... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
Whether to find a batch size that will fit into memory automatically through exponential decay, avoiding
CUDA Out-of-Memory errors. Requires accelerate to be installed (`pip install accelerate`)
full_determinism (`bool`, *optional*, defaults to `False`)
If `True`, [`enable_full_determini... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
then use the last checkpoint of all trials, compare those, and select the best one. However, other options
are also available. See the [Ray documentation](
https://docs.ray.io/en/latest/tune/api_docs/analysis.html#ray.tune.ExperimentAnalysis.get_best_trial) for
more options.
... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
Whether or not to compile the model using PyTorch 2.0
[`torch.compile`](https://pytorch.org/get-started/pytorch-2.0/). | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
This will use the best defaults for the [`torch.compile`
API](https://pytorch.org/docs/stable/generated/torch.compile.html?highlight=torch+compile#torch.compile).
You can customize the defaults with the argument `torch_compile_backend` and `torch_compile_mode` but we
don't guarantee ... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
This flag is experimental and subject to change in future releases.
torch_compile_mode (`str`, *optional*):
The mode to use in `torch.compile`. If set to any value, `torch_compile` will be set to `True`.
Refer to the PyTorch doc for possible values and note that they may change across P... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
This will iterate over the entire training dataloader once beforehand,
and will slow down the entire process.
include_num_input_tokens_seen (`bool`, *optional*):
Whether or not to track the number of input tokens seen throughout training.
May be slower in distributed train... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
neftune_noise_alpha (`Optional[float]`):
If not `None`, this will activate NEFTune noise embeddings. This can drastically improve model performance
for instruction fine-tuning. Check out the [original paper](https://arxiv.org/abs/2310.05914) and the
[original code](https://github.com... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
only. | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
batch_eval_metrics (`Optional[bool]`, defaults to `False`):
If set to `True`, evaluation will call compute_metrics at the end of each batch to accumulate statistics
rather than saving all eval logits in memory. When set to `True`, you must pass a compute_metrics function
that takes a... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
eval_use_gather_object (`bool`, *optional*, defaults to `False`):
Whether to run recursively gather object in a nested list/tuple/dictionary of objects from all devices. This should only be enabled if users are not just returning tensors, and this is actively discouraged by PyTorch.
use_liger_kerne... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
framework = "pt"
output_dir: str = field(
metadata={"help": "The output directory where the model predictions and checkpoints will be written."},
)
overwrite_output_dir: bool = field(
default=False,
metadata={
"help": (
"Overwrite the content of the output... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
do_train: bool = field(default=False, metadata={"help": "Whether to run training."})
do_eval: bool = field(default=False, metadata={"help": "Whether to run eval on the dev set."})
do_predict: bool = field(default=False, metadata={"help": "Whether to run predictions on the test set."})
eval_strategy: Union[I... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
per_gpu_train_batch_size: Optional[int] = field(
default=None,
metadata={
"help": (
"Deprecated, the use of `--per_device_train_batch_size` is preferred. "
"Batch size per GPU/TPU core/CPU for training."
)
},
)
per_gpu_eval_batch_si... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
eval_delay: Optional[float] = field(
default=0,
metadata={
"help": (
"Number of epochs or steps to wait for before the first evaluation can be performed, depending on the"
" eval_strategy."
)
},
)
torch_empty_cache_steps: Optional[... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
learning_rate: float = field(default=5e-5, metadata={"help": "The initial learning rate for AdamW."})
weight_decay: float = field(default=0.0, metadata={"help": "Weight decay for AdamW if we apply some."})
adam_beta1: float = field(default=0.9, metadata={"help": "Beta1 for AdamW optimizer"})
adam_beta2: flo... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
num_train_epochs: float = field(default=3.0, metadata={"help": "Total number of training epochs to perform."})
max_steps: int = field(
default=-1,
metadata={"help": "If > 0: set total number of training steps to perform. Override num_train_epochs."},
)
lr_scheduler_type: Union[SchedulerType,... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
log_level: Optional[str] = field(
default="passive",
metadata={
"help": (
"Logger log level to use on the main node. Possible choices are the log levels as strings: 'debug',"
" 'info', 'warning', 'error' and 'critical', plus a 'passive' level which doesn't set... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
},
)
logging_dir: Optional[str] = field(default=None, metadata={"help": "Tensorboard log dir."})
logging_strategy: Union[IntervalStrategy, str] = field(
default="steps",
metadata={"help": "The logging strategy to use."},
)
logging_first_step: bool = field(default=False, metadata={"he... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
"help": (
"Save checkpoint every X updates steps. Should be an integer or a float in range `[0,1)`. "
"If smaller than 1, will be interpreted as ratio of total training steps."
)
},
)
save_total_limit: Optional[int] = field(
default=None,
metad... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
" it is possible that two checkpoints are saved: the last one and the best one (if they are different)."
" Default is unlimited checkpoints"
)
},
)
save_safetensors: Optional[bool] = field(
default=True,
metadata={
"help": "Use safetensors saving a... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
"Note that when this is true, you won't be able to resume training from checkpoint."
"This enables you to save storage by not storing the optimizer, scheduler & rng state."
"You can only load the model using from_pretrained with this option set to True."
)
},
)
... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
use_mps_device: bool = field(
default=False,
metadata={
"help": "This argument is deprecated. `mps` device will be used if available similar to `cuda` device."
" It will be removed in version 5.0 of 🤗 Transformers"
},
)
seed: int = field(default=42, metadata={"he... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
"Whether to use bf16 (mixed) precision instead of 32-bit. Requires Ampere or higher NVIDIA"
" architecture or using CPU (use_cpu) or Ascend NPU. This is an experimental API and it may change."
)
},
)
fp16: bool = field(
default=False,
metadata={"help": "Whethe... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
"Whether to use full bfloat16 evaluation instead of 32-bit. This is an experimental API and it may"
" change."
)
},
)
fp16_full_eval: bool = field(
default=False,
metadata={"help": "Whether to use full float16 evaluation instead of 32-bit"},
)
tf32: Op... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
default=None, metadata={"help": "TPU: Number of TPU cores (automatically passed by launcher script)"}
)
tpu_metrics_debug: bool = field(
default=False,
metadata={
"help": (
"Deprecated, the use of `--debug tpu_metrics_debug` is preferred. TPU: Whether to print debug m... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
dataloader_drop_last: bool = field(
default=False, metadata={"help": "Drop the last incomplete batch if it is not divisible by the batch size."}
)
eval_steps: Optional[float] = field(
default=None,
metadata={
"help": (
"Run an evaluation every X steps. Should ... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
"2 means there will be a total of 2 * num_workers batches prefetched across all workers. "
"Default is 2 for PyTorch < 2.0.0 and otherwise None."
)
},
)
past_index: int = field(
default=-1,
metadata={"help": "If >=0, uses the corresponding part of the output a... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
run_name: Optional[str] = field(
default=None,
metadata={"help": "An optional descriptor for the run. Notably used for wandb, mlflow and comet logging."},
)
disable_tqdm: Optional[bool] = field(
default=None, metadata={"help": "Whether or not to disable the tqdm progress bars."}
) | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
remove_unused_columns: Optional[bool] = field(
default=True, metadata={"help": "Remove columns not required by the model when using an nlp.Dataset."}
)
label_names: Optional[List[str]] = field(
default=None, metadata={"help": "The list of keys in your dictionary of inputs that correspond to the ... | 179 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.