L i`|ddlZddlZddlZddlZddlZddlmZmZmZm Z ddl m Z ddl m Z ddlmZddlmZddlmZmZmZddlmZd d lmZd d lmZmZmZmZmZm Z d d l!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6d d l7m8Z8d dl9m:Z:e5jve<Z=e5j|jZ@eAd,ie@ddiZBe)r ddlCZCddlDmEZFe$rddlGmHZHmIZIddlJmKZKd dlLmMZMe$drddlNmOZOneZOe3r ddlPmQcmRZSe0drejjdre:re=jdne=jdddlXmEcmYZZe[eFjjeZjsBeFjde[eFjjeZjse`de(rddlambcmCZcecjdeefdZfd Zgd!d"deeefd#ZhGd$d%e#Zid&eAfd'ZjeGd(d)ZkGd*d+e Zly)-N)asdict dataclassfieldfields) timedelta)Enum)cached_property)Path)AnyOptionalUnion)get_full_repo_name) DebugOption)EvaluationStrategy FSDPOption HubStrategyIntervalStrategy SaveStrategy SchedulerType)ACCELERATE_MIN_VERSION ExplicitEnumis_accelerate_availableis_apex_availableis_ipex_availableis_sagemaker_dp_enabledis_sagemaker_mp_enabledis_torch_availableis_torch_bf16_gpu_availableis_torch_cuda_availableis_torch_hpu_availableis_torch_mlu_availableis_torch_mps_availableis_torch_musa_availableis_torch_neuroncore_availableis_torch_npu_availableis_torch_tf32_availableis_torch_xla_availableis_torch_xpu_availableloggingrequires_backends) strtobool)is_optimum_neuron_availablepassive)AcceleratorState PartialState)DistributedType)AcceleratorConfigz1.10.1)ParallelismConfigF) check_deviceTORCHELASTIC_RUN_IDzuMake sure that you are performing the training with the NeuronTrainer from optimum[neuron], this will fail otherwise.zPlease use the NeuronTrainer from optimum[neuron] instead of the Transformers library to perform training on AWS Trainium instances. More information here: https://github.com/huggingface/optimum-neuronxla)backendzGFailed to initialize torch.distributed process group using XLA backend.returncddl}ddlm}|jjd}tj j d|dz|jzS)z! Same default as PyTorch rN)datetimez %b%d_%H-%M-%Sruns_)socketr;nowstrftimeospathjoin gethostname)r>r; current_times `/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/transformers/training_args.pydefault_logdirrGtsH!<<>**?;L 77<< s 2V5G5G5I I JJcx|D]4}ttjj|d}|dk\s2|cS|S)zQReturns the first positive env value found in the `env_keys` list or the default.z-1r)intrAenvironget)env_keysdefaultevals rFget_int_from_envrQs= "**..D)* !8J NrHdevice torch.devicectr;|jdk(rytj|gdj ddSy)z^ Returns the xla device type (CPU|GPU|TPU) or None if the device is a non-xla device. cpuCPUr:N)r(typexmxla_real_devicessplit)rRs rFget_xla_device_typer\sD ;;% ""F8,Q/55c:1== rHceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-y,)-OptimizerNameszB Stores the acceptable string identifiers for optimizers. adamw_torchadamw_torch_fusedadamw_torch_xlaadamw_torch_npu_fusedadamw_apex_fused adafactoradamw_anyprecisionadamw_torch_4bitadamw_torch_8bitademamixsgdadagradadamw_bnb_8bit adamw_8bit ademamix_8bit lion_8bit lion_32bitpaged_adamw_32bitpaged_adamw_8bitpaged_ademamix_32bitpaged_ademamix_8bitpaged_lion_32bitpaged_lion_8bitrmsprop rmsprop_bnbrmsprop_bnb_8bitrmsprop_bnb_32bit galore_adamwgalore_adamw_8bitgalore_adafactorgalore_adamw_layerwisegalore_adamw_8bit_layerwisegalore_adafactor_layerwiselomoadalomo grokadamwschedule_free_radamschedule_free_adamwschedule_free_sgd apollo_adamwapollo_adamw_layerwise stable_adamwN).__name__ __module__ __qualname____doc__ ADAMW_TORCHADAMW_TORCH_FUSEDADAMW_TORCH_XLAADAMW_TORCH_NPU_FUSEDADAMW_APEX_FUSED ADAFACTORADAMW_ANYPRECISIONADAMW_TORCH_4BITADAMW_TORCH_8BITADEMAMIXSGDADAGRAD ADAMW_BNB ADAMW_8BIT ADEMAMIX_8BIT LION_8BITLION PAGED_ADAMWPAGED_ADAMW_8BITPAGED_ADEMAMIXPAGED_ADEMAMIX_8BIT PAGED_LIONPAGED_LION_8BITRMSPROP RMSPROP_BNB RMSPROP_8BIT RMSPROP_32BIT GALORE_ADAMWGALORE_ADAMW_8BITGALORE_ADAFACTORGALORE_ADAMW_LAYERWISEGALORE_ADAMW_8BIT_LAYERWISEGALORE_ADAFACTOR_LAYERWISELOMOADALOMO GROKADAMWSCHEDULE_FREE_RADAMSCHEDULE_FREE_ADAMWSCHEDULE_FREE_SGD APOLLO_ADAMWAPOLLO_ADAMW_LAYERWISE STABLE_ADAMWrHrFr^r^s K+'O3)I-))H CG IJ#MI D%K)+N/#J'OGK%L'M!L+)5"?!= DGI//+!L5!LrHr^ passed_valuec|jD]\}}t|trt|||<%t|ts6|j dvr|j dk(||<_|j rt|||<~|jdddj st|||<|S)zlSafely checks that a passed value is a dictionary and converts any string values to their appropriate types.)truefalser.r) items isinstancedict_convert_str_dictstrlowerisdigitrJreplacefloat)rkeyvalues rFrrs"((* 1 U eT " 1% 8L  s #{{} 11$)KKMV$; S!$'J S!sB*224$)%L S! 1 rHceZdZUdZgdZdZedddiZee e d<ed dd iZ e e d <ed dd iZ e e d <ed ddiZe e d<ed ddiZe e d<edddiZeee fe d<ed ddiZe e d<edddiZee d<edddiZee d<edddiZeee d<edddiZeee d<ed dd!iZee d"<eddd#iZeee d$<ed%dd&iZee d'<eddd(iZeee d)<ed*dd+iZee d,<ed-dd.iZee d/<ed0dd1iZ ee d2<ed3dd4iZ!ee d5<ed6dd7iZ"ee d8<ed9dd:iZ#ee d;<ed<ed?dd@iZ%ee dA<edBddCiZ&ee'e fe dD<ee(ddEiFZ)ee(e e*fe fe dG<ed-ddHiZ+ee dI<ed%ddJiZ,ee dK<edLdMe-j]dNZ/e e dO<edPdQe-j]dNZ0e e dR<edSddTiZ1e e dU<edddViZ2ee e dW<edXddYiZ3eee fe dZ<ed dd[iZ4e e d\<ed]dd^iZ5ee d_<edSdd`iZ6e e da<edXddbiZ7ee8e fe dc<ed]dddiZ9ee de<edddfiZ:eee dg<edSddhiZ;e e di<ed ddjiZe e do<ed ddpiZ?e e dq<ed ddriZ@e e ds<ed ddtiZAe e du<edvddwiZBee dx<edddyiZCeee dz<ed dd{iZDe e d|<ed dd}iZEe e d~<ed ddiZFe e d<edddiZGe e d<eddgddNZHe e d<ed ddiZIe e d<ed ddiZJe e d<edddiZKee e d<ed?ddiZLee d<eddgddNZMee e d<edddiZNeee d<ed ddiZOe e d<edddiZPee eQeRfe d<ed ddiZSe e d<edddiZTeee d<ed%ddiZUee d<edddiZVeee d<ed?ddiZWee d<edddiZXee e d<edddiZYee e d<edSddiZZe e d<edddiZ[eeQe e d<ed ddiZ\e e d<edddiZ]ee e d<edddiZ^ee e d<ed ddiZ_e e d<edddiZ`eeeQeae fe d<ed%ddiZbee d<edddiZceee(e e*fe fe d<edddiZdee e d<edddiZeeee(e fe d<edddiZfeege d<edddiZheee(e fe d<ed-ddiZiee d<dZjekr d dllmmZmemrdZjeejddiZneeoe fe d<edddiZpee e d<ed ddiZqe e d<ed ddiZre e d<edddiZse e d<edddiZtede eQe fe d<edddiZue e d<edddiZvee e d<edddiZwee e d<edddiZxeee d<edddiZyee e d<edSddiZze e d<ed ddiZ{e e d<edSddiZ|e e d<ed ddiZ}e e d<ed ddiZ~e e d<edddiZee e d<edddiZee e d<edddiZeee fe d<edddiZee e d<edddiZee e d<ed ddiZe e d<edddiZee e d<ed ddiZe e d<edddiZeee(e e*fe fe d<ed ddiZe e d<eeQddiFZeQe e d<edSddiZe e d<eddgddNZe e d<edddiZee e d<edddiZee e d<edddiZee e d <ed d d? Zee d <eddd iZe e d <ed ddiZe e d<ed ddiZe e d<edddiZee e d<edddiZee e d<edddiZee d<ed ddiZe e d<edddiZee e d<edddiZee e d<ed dd iZe e d!<ed dd"iZee e fe d#<eddd$iZeee d%<eddd&iZede eQe fe d'<ed dd(iZe e d)<ed dd*iZe e d+<ed dd,iZe e d-<eddd.iZee(e e fe d/<ed dd0iZe e d1<edSdd2iZe e d3<d4Zd5ZeZed6efd7Zed6efd8Zed6efd9Zedvd:Zedvd;Zed<Zed=Zed>Zed?Zed@ZedAZedBZdCZedDZedEZejtdwdFZdGefdHZdIe(e e*fd6dfdJZdKZdLZd6e(e e*ffdMZ dxd,edNed/edOedAed"edxede fdPZ dydQee efdXedNedReedSeedTe dUe fdVZ dzdNedTe dUe fdWZ d{dQee efdXedXeedYe fdZZ d|dQee efdXedee eQe fd[e d\e d]e dYe d^e fd_Z d}d`e dQee efdaee dbee dce ddee f deZ d~dfee eofd,ed/edgedhediedjee fdkZ ddfee e'fdOedAedIedKef dlZ ddmednedoe dpedqe dre dseede de dteefduZy(TrainingArgumentsaܴ 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 on the command line. Parameters: output_dir (`str`, *optional*, defaults to `"trainer_output"`): 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` points to a checkpoint directory. do_train (`bool`, *optional*, defaults to `False`): Whether to run training or not. 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/transformers/tree/main/examples) for more details. do_eval (`bool`, *optional*): Whether to run evaluation on the validation set or not. Will be set to `True` if `eval_strategy` is different from `"no"`. 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/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 [`Trainer`], it's intended to be used by your training/evaluation scripts instead. See the [example scripts](https://github.com/huggingface/transformers/tree/main/examples) for more details. eval_strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"no"`): The evaluation strategy to adopt during training. Possible values are: - `"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 generating predictions, only returns the loss. per_device_train_batch_size (`int`, *optional*, defaults to 8): The batch size *per device*. The **global batch size** is computed as: `per_device_train_batch_size * number_of_devices` in multi-GPU or distributed setups. per_device_eval_batch_size (`int`, *optional*, defaults to 8): The batch size per device accelerator core/CPU for evaluation. gradient_accumulation_steps (`int`, *optional*, defaults to 1): Number of updates steps to accumulate the gradients for, before performing a backward/update pass. 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. eval_accumulation_steps (`int`, *optional*): Number of predictions steps to accumulate the output tensors for, before moving the results to the CPU. If left unset, the whole predictions are accumulated on the device accelerator before being moved to the CPU (faster but requires more memory). eval_delay (`float`, *optional*): Number of epochs or steps to wait for before the first evaluation can be performed, depending on the eval_strategy. torch_empty_cache_steps (`int`, *optional*): Number of steps to wait before calling `torch..empty_cache()`. If left unset or set to None, cache will not be emptied. 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). 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. adam_beta1 (`float`, *optional*, defaults to 0.9): The beta1 hyperparameter for the [`AdamW`] optimizer. adam_beta2 (`float`, *optional*, defaults to 0.999): The beta2 hyperparameter for the [`AdamW`] optimizer. adam_epsilon (`float`, *optional*, defaults to 1e-8): The epsilon hyperparameter for the [`AdamW`] optimizer. max_grad_norm (`float`, *optional*, defaults to 1.0): Maximum gradient norm (for gradient clipping). num_train_epochs(`float`, *optional*, defaults to 3.0): Total number of training epochs to perform (if not an integer, will perform the decimal part percents of 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) until `max_steps` is reached. lr_scheduler_type (`str` or [`SchedulerType`], *optional*, defaults to `"linear"`): The scheduler type to use. See the documentation of [`SchedulerType`] for all possible values. lr_scheduler_kwargs ('dict', *optional*, defaults to {}): The extra arguments for the lr_scheduler. See the documentation of each scheduler for possible values. warmup_ratio (`float`, *optional*, defaults to 0.0): Ratio of total training steps used for a linear warmup from 0 to `learning_rate`. warmup_steps (`int`, *optional*, defaults to 0): 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', 'error' and 'critical', plus a 'passive' level which doesn't set anything and keeps the current log level for the Transformers library (which will be `"warning"` by default). log_level_replica (`str`, *optional*, defaults to `"warning"`): Logger log level to use on replicas. Same choices as `log_level`" log_on_each_node (`bool`, *optional*, defaults to `True`): In multinode distributed training, whether to log using `log_level` once per node, or only on the main node. logging_dir (`str`, *optional*): [TensorBoard](https://www.tensorflow.org/tensorboard) log directory. Will default to *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: - `"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. logging_steps (`int` or `float`, *optional*, defaults to 500): Number of update steps between two logs if `logging_strategy="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. logging_nan_inf_filter (`bool`, *optional*, defaults to `True`): Whether to filter `nan` and `inf` losses for logging. If set to `True` the loss of every step that is `nan` or `inf` is filtered and the average loss of the current logging window is taken instead. `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. save_strategy (`str` or [`~trainer_utils.SaveStrategy`], *optional*, defaults to `"steps"`): The checkpoint save strategy to adopt during training. Possible values are: - `"no"`: No save is done during training. - `"epoch"`: Save is done at the end of each epoch. - `"steps"`: Save is done every `save_steps`. - `"best"`: Save is done whenever a new `best_metric` is achieved. 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 float in range `[0,1)`. If smaller than 1, will be interpreted as ratio of total training steps. save_total_limit (`int`, *optional*): If a value is passed, will limit the total amount of checkpoints. Deletes the older checkpoints in `output_dir`. When `load_best_model_at_end` is enabled, the "best" checkpoint according to `metric_for_best_model` will always be retained in addition to the most recent ones. For example, for `save_total_limit=5` and `load_best_model_at_end`, the four last checkpoints will always be retained 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/safetensors) saving and loading for state dicts instead of default `torch.load` and `torch.save`. save_on_each_node (`bool`, *optional*, defaults to `False`): When doing multi-node distributed training, whether to save models and checkpoints on each node, or only on the main one. 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 state. 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`. restore_callback_states_from_checkpoint (`bool`, *optional*, defaults to `False`): Whether to restore the callback states from the checkpoint. If `True`, will override callbacks passed to the `Trainer` if they exist in the checkpoint." use_cpu (`bool`, *optional*, defaults to `False`): 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 model if it has some randomly initialized parameters. data_seed (`int`, *optional*): Random seed to be used with data samplers. If not set, random generators for data sampling will use the same seed as `seed`. This can be used to ensure reproducibility of data sampling, independent of the model seed. jit_mode_eval (`bool`, *optional*, defaults to `False`): Whether or not to use PyTorch jit trace for inference. 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 Intel XPU or using CPU (use_cpu) or Ascend NPU. fp16 (`bool`, *optional*, defaults to `False`): Whether to use fp16 16-bit (mixed) precision training instead of 32-bit training. fp16_opt_level (`str`, *optional*, defaults to 'O1'): For `fp16` training, Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. See details on the [Apex documentation](https://nvidia.github.io/apex/amp). fp16_backend (`str`, *optional*, defaults to `"auto"`): This argument is deprecated. Use `half_precision_backend` instead. half_precision_backend (`str`, *optional*, defaults to `"auto"`): 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`): Whether to use full bfloat16 evaluation instead of 32-bit. This will be faster and save memory but can harm metric values. fp16_full_eval (`bool`, *optional*, defaults to `False`): Whether to use full float16 evaluation instead of 32-bit. This will be faster and save memory but can harm metric values. tf32 (`bool`, *optional*): Whether to enable the TF32 mode, available in Ampere and newer GPU architectures. The default value depends on PyTorch's version default of `torch.backends.cuda.matmul.allow_tf32`. For more details please refer to 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*): The backend to use for distributed training. Must be one of `"nccl"`, `"mpi"`, `"ccl"`, `"gloo"`, `"hccl"`. tpu_num_cores (`int`, *optional*): When training on TPU, the number of TPU cores (automatically passed by launcher script). dataloader_drop_last (`bool`, *optional*, defaults to `False`): Whether to drop the last incomplete batch (if the length of the dataset is not divisible by the batch size) or not. eval_steps (`int` or `float`, *optional*): Number of update steps between two evaluations if `eval_strategy="steps"`. Will default to the same 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 means that the data will be loaded in the main process. past_index (`int`, *optional*, defaults to -1): Some models like [TransformerXL](../model_doc/transformerxl) or [XLNet](../model_doc/xlnet) can make use of the past hidden states for their predictions. If this argument is set to a positive int, the `Trainer` will use the corresponding output (usually index 2) as the past state and feed it to the model at the next training step under the keyword argument `mems`. run_name (`str`, *optional*, defaults to `output_dir`): A descriptor for the run. Typically used for [trackio](https://github.com/gradio-app/trackio), [wandb](https://www.wandb.com/), [mlflow](https://www.mlflow.org/), [comet](https://www.comet.com/site) and [swanlab](https://swanlab.cn) 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.NotebookTrainingTracker`] in Jupyter Notebooks. Will default to `True` if the logging level is set to warn or lower (default), `False` otherwise. remove_unused_columns (`bool`, *optional*, defaults to `True`): Whether or not to automatically remove the columns unused by the model forward method. label_names (`list[str]`, *optional*): The list of keys in your dictionary of inputs that correspond to the labels. 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. You should only specify `label_names` if you're using custom label names or if your model's `forward` consumes multiple label tensors (e.g., extractive QA). load_best_model_at_end (`bool`, *optional*, defaults to `False`): Whether or not to load the best model found during training at the end of training. When this option is enabled, the best checkpoint will always be saved. See [`save_total_limit`](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.save_total_limit) for more. When set to `True`, the parameters `save_strategy` needs to be the same as `eval_strategy`, and in the case it is "steps", `save_steps` must be a round multiple of `eval_steps`. 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 to `"loss"` when either `load_best_model_at_end == True` or `lr_scheduler_type == SchedulerType.REDUCE_ON_PLATEAU` (to use the evaluation loss). If you set this value, `greater_is_better` will default to `True` unless the name ends with "loss". Don't forget to set it to `False` if your metric is better when lower. greater_is_better (`bool`, *optional*): Use in conjunction with `load_best_model_at_end` and `metric_for_best_model` to specify if better models should have a greater metric or not. Will default to: - `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 epochs and batches to get the data loading at the same stage as in the previous training. If set to `True`, the training will begin faster (as that skipping step can take a long time) but will not yield the same results as the interrupted training would have. fsdp (`bool`, `str` or list of [`~trainer_utils.FSDPOption`], *optional*, defaults to `None`): Use PyTorch Distributed Parallel Training (in distributed training only). A list of options along the following: - `"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, and replicate parameters across nodes. - `"offload"`: Offload parameters and gradients to CPUs (only compatible with `"full_shard"` and `"shard_grad_op"`). - `"auto_wrap"`: Automatically recursively wrap layers with FSDP using `default_auto_wrap_policy`. fsdp_config (`str` or `dict`, *optional*): Config to be used with fsdp (Pytorch Distributed Parallel Training). The value is either a location of fsdp json config file (e.g., `fsdp_config.json`) or an already loaded json file as `dict`. 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]`, *optional*): List of transformer layer class names (case-sensitive) to wrap, e.g, `BertLayer`, `GPTJBlock`, `T5Block` .... (useful only when `fsdp` flag is passed). - backward_prefetch (`str`, *optional*) FSDP's backward prefetch mode. Controls when to prefetch next set of parameters (useful only when `fsdp` field is passed). A list of options along the following: - `"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 gradient computation. - forward_prefetch (`bool`, *optional*, defaults to `False`) FSDP's forward prefetch mode (useful only when `fsdp` field is passed). If `"True"`, then FSDP explicitly prefetches the next upcoming all-gather while executing in the forward pass. - limit_all_gathers (`bool`, *optional*, defaults to `False`) FSDP's limit_all_gathers (useful only when `fsdp` field is passed). If `"True"`, FSDP explicitly synchronizes the CPU thread to prevent too many in-flight all-gathers. - 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 parameters. Useful in cases such as parameter-efficient fine-tuning. Please refer this [blog](https://dev-discuss.pytorch.org/t/rethinking-pytorch-fully-sharded-data-parallel-fsdp-from-first-principles/1019 - sync_module_states (`bool`, *optional*, defaults to `True`) If `"True"`, each individually wrapped FSDP unit will broadcast module parameters from rank 0 to ensure they are the same across all ranks after initialization - cpu_ram_efficient_loading (`bool`, *optional*, defaults to `False`) If `"True"`, only the first process loads the pretrained model checkpoint while all other processes 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`, *optional*, defaults to `False`): If `"True"`, activation checkpointing is a technique to reduce memory usage by clearing activations of certain layers and recomputing them during a backward pass. Effectively, this trades extra computation time for reduced memory usage. - xla (`bool`, *optional*, defaults to `False`): Whether to use PyTorch/XLA Fully Sharded Data Parallel Training. This is an experimental feature and its API may evolve in the future. - xla_fsdp_settings (`dict`, *optional*) The value is a dictionary which stores the XLA FSDP wrapping parameters. 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 nested XLA FSDP wrapped layer. This setting can only be used when the xla flag is set to true, and an auto wrapping policy is specified through fsdp_min_num_params or fsdp_transformer_layer_cls_to_wrap. deepspeed (`str` or `dict`, *optional*): Use [Deepspeed](https://github.com/deepspeedai/DeepSpeed). This is an experimental feature and its API may evolve in the future. The value is either the location of DeepSpeed json config file (e.g., `ds_config.json`) or an already loaded json file as a `dict`" If enabling any Zero-init, make sure that your model is not initialized until *after* initializing the `TrainingArguments`, else it will not be applied. accelerator_config (`str`, `dict`, or `AcceleratorConfig`, *optional*): Config to be used with the internal `Accelerator` implementation. The value is either a location of accelerator json config file (e.g., `accelerator_config.json`), an already loaded json file as `dict`, or an instance of [`~trainer_pt_utils.AcceleratorConfig`]. 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 distributed processes, but it must be a round multiple of the `num_processes` you are using. If `False`, actual batch size used will be the one set in your script multiplied by the number of processes. - dispatch_batches (`bool`, *optional*): If set to `True`, the dataloader prepared by the Accelerator is only iterated through on the main process and then the batches are split and broadcast to each process. Will default to `True` for `DataLoader` whose underlying dataset is an `IterableDataset`, `False` otherwise. - 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 all workers. - use_seedable_sampler (`bool`, *optional*, defaults to `True`): Whether or not use a fully seedable random sampler ([`accelerate.data_loader.SeedableRandomSampler`]). Ensures training results are fully reproducible using a different sampling technique. While seed-to-seed results may differ, on average the differences are negligible when using multiple different seeds to compare. Should also be ran with [`~utils.set_seed`] for the best results. - use_configured_state (`bool`, *optional*, defaults to `False`): 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. parallelism_config (`ParallelismConfig`, *optional*): Parallelism configuration for the training run. Requires Accelerate `1.10.1` 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_smoothing_factor/num_labels` respectively. debug (`str` or list of [`~debug_utils.DebugOption`], *optional*, defaults to `""`): Enable one or more debug features. This is an experimental feature. Possible options are: - `"underflow_overflow"`: detects overflow in model's input/outputs and reports the last frames that led to the event - `"tpu_metrics_debug"`: print debug metrics on TPU The options should be separated by whitespaces. optim (`str` or [`training_args.OptimizerNames`], *optional*, defaults to `"adamw_torch"` (for torch>=2.8 `"adamw_torch_fused"`)): The optimizer to use, such as "adamw_torch", "adamw_torch_fused", "adamw_apex_fused", "adamw_anyprecision", "adafactor". See `OptimizerNames` in [training_args.py](https://github.com/huggingface/transformers/blob/main/src/transformers/training_args.py) for a full list of optimizers. optim_args (`str`, *optional*): Optional arguments that are supplied to optimizers such as AnyPrecisionAdamW, AdEMAMix, and GaLore. group_by_length (`bool`, *optional*, defaults to `False`): Whether or not to group together samples of roughly the same length in the training dataset (to minimize padding applied and be more efficient). Only useful if applying dynamic padding. length_column_name (`str`, *optional*, defaults to `"length"`): 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 to `"all"`): The list of integrations to report the results and logs to. Supported platforms are `"azure_ml"`, `"clearml"`, `"codecarbon"`, `"comet_ml"`, `"dagshub"`, `"dvclive"`, `"flyte"`, `"mlflow"`, `"neptune"`, `"swanlab"`, `"tensorboard"`, `"trackio"` and `"wandb"`. Use `"all"` to report to all integrations installed, `"none"` for no integrations. project (`str`, *optional*, defaults to `"huggingface"`): The name of the project to use for logging. Currently, only used by Trackio. trackio_space_id (`str` or `None`, *optional*, defaults to `"trackio"`): The Hugging Face Space ID to deploy to when using Trackio. Should be a complete Space name like `'username/reponame'` or `'orgname/reponame' `, or just `'reponame'` in which case the Space will be created in the currently-logged-in Hugging Face user's namespace. If `None`, will log to a local directory. Note that this Space will be public unless you set `hub_private_repo=True` or your organization's default is to create private Spaces." ddp_find_unused_parameters (`bool`, *optional*): When using distributed training, the value of the flag `find_unused_parameters` passed to `DistributedDataParallel`. Will default to `False` if gradient checkpointing is used, `True` otherwise. 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 `DistributedDataParallel`. Will default to `False` if gradient checkpointing is used, `True` otherwise. dataloader_pin_memory (`bool`, *optional*, defaults to `True`): Whether you want to pin memory in data loaders or not. Will default to `True`. dataloader_persistent_workers (`bool`, *optional*, defaults to `False`): If True, the data loader will not shut down the worker processes after a dataset has been consumed once. This allows to maintain the workers Dataset instances alive. Can potentially speed up training, but will increase RAM usage. Will default to `False`. dataloader_prefetch_factor (`int`, *optional*): 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 default because it slows down the training and evaluation speed. push_to_hub (`bool`, *optional*, defaults to `False`): Whether or not to push the model to the Hub every time the model is saved. If this is activated, `output_dir` will begin a git directory synced with the repo (determined by `hub_model_id`) and the content will be pushed each time a save is triggered (depending on your `save_strategy`). Calling [`~Trainer.save_model`] will also trigger a push. If `output_dir` exists, it needs to be a local clone of the repository to which the [`Trainer`] will be pushed. 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/transformers/tree/main/examples) for more details. hub_model_id (`str`, *optional*): The name of the repository to keep in sync with the local *output_dir*. It can be a simple model ID in which case the model will be pushed in your namespace. Otherwise it should be the whole repository name, for instance `"user_name/model"`, which allows you to push to an organization you are a member of with `"organization_name/model"`. Will default to `user_name/output_dir_name` with *output_dir_name* being the name of `output_dir`. 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: - `"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 passed along to the [`Trainer`]) and a draft of a model card each time there is a model save. The pushes are asynchronous to not block training, and in case the save are very frequent, a new push is only attempted if the previous one is finished. A last push is made with the final model at the end of training. - `"checkpoint"`: like `"every_save"` but the latest checkpoint is also pushed in a subfolder named last-checkpoint, allowing you to resume training easily with `trainer.train(resume_from_checkpoint="last-checkpoint")`. - `"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) 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 `hf auth login`. hub_private_repo (`bool`, *optional*): Whether to make the repo private. If `None` (default), the repo will be public unless the organization's default is private. This value is ignored if the repo already exists. If reporting to Trackio with deployment to Hugging Face Spaces enabled, the same logic determines whether the Space is private. hub_always_push (`bool`, *optional*, defaults to `False`): Unless this is `True`, the `Trainer` will skip pushing a checkpoint when the previous push is not finished. hub_revision (`str`, *optional*): The revision to use when pushing to the Hub. Can be a branch name, a tag, or a commit hash. gradient_checkpointing (`bool`, *optional*, defaults to `False`): If True, use gradient checkpointing to save memory at the expense of slower backward pass. gradient_checkpointing_kwargs (`dict`, *optional*, defaults to `None`): Key word arguments to be passed to the `gradient_checkpointing_enable` method. 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` function if needed for metrics computation. Possible options to add to `include_for_metrics` list: - `"inputs"`: Input data passed to the model, intended for calculating input dependent metrics. - `"loss"`: Loss values computed during evaluation, intended for calculating loss dependent metrics. eval_do_concat_batches (`bool`, *optional*, defaults to `True`): Whether to recursively concat inputs/losses/labels/predictions across batches. If `False`, will instead store them as lists, with each batch kept separate. auto_find_batch_size (`bool`, *optional*, defaults to `False`) 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_determinism`] is called instead of [`set_seed`] to ensure reproducible results in distributed training. Important: this will negatively impact the performance, so only use it for debugging. torchdynamo (`str`, *optional*): If set, the backend compiler for TorchDynamo. Possible choices are `"eager"`, `"aot_eager"`, `"inductor"`, `"nvfuser"`, `"aot_nvfuser"`, `"aot_cudagraphs"`, `"ofi"`, `"fx2trt"`, `"onnxrt"` and `"ipex"`. ray_scope (`str`, *optional*, defaults to `"last"`): The scope to use when doing hyperparameter search with Ray. By default, `"last"` will be used. Ray will 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. ddp_timeout (`int`, *optional*, defaults to 1800): The timeout for `torch.distributed.init_process_group` calls, used to avoid GPU socket timeouts when performing slow operations in distributed runnings. Please refer the [PyTorch documentation] (https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group) for more information. use_mps_device (`bool`, *optional*, defaults to `False`): This argument is deprecated.`mps` device will be used if it is available similar to `cuda` device. torch_compile (`bool`, *optional*, defaults to `False`): Whether or not to compile the model using PyTorch 2.0 [`torch.compile`](https://pytorch.org/get-started/pytorch-2.0/). 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 any of them will work as the support is progressively rolled in in PyTorch. This flag and the whole compile API is experimental and subject to change in future releases. torch_compile_backend (`str`, *optional*): The backend 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 PyTorch versions. 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 PyTorch versions. This flag is experimental and subject to change in future releases. include_tokens_per_second (`bool`, *optional*, defaults to `False`): Whether or not to compute the number of tokens per second per device for training speed metrics. 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 training as gather operations must be called. 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://huggingface.co/papers/2310.05914) and the [original code](https://github.com/neelsjain/NEFTune). Support transformers `PreTrainedModel` and also `PeftModel` from peft. The original paper used values in the range [5.0, 15.0]. optim_target_modules (`Union[str, list[str]]`, *optional*): The target modules to optimize, i.e. the module names that you would like to train. Currently used for the GaLore algorithm (https://huggingface.co/papers/2403.03507) and APOLLO algorithm (https://huggingface.co/papers/2412.05270). See GaLore implementation (https://github.com/jiaweizzhao/GaLore) and APOLLO implementation (https://github.com/zhuhanqing/APOLLO) for more details. You need to make sure to pass a valid GaLore or APOLLO optimizer, e.g., one of: "apollo_adamw", "galore_adamw", "galore_adamw_8bit", "galore_adafactor" and make sure that the target modules are `nn.Linear` modules only. batch_eval_metrics (`bool`, *optional*, 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 boolean argument `compute_result`, which when passed `True`, will trigger the final global summary statistics from the batch-level summary statistics you've accumulated over the evaluation set. eval_on_start (`bool`, *optional*, defaults to `False`): Whether to perform a evaluation step (sanity check) before the training to ensure the validation steps works correctly. 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_kernel (`bool`, *optional*, defaults to `False`): Whether enable [Liger](https://github.com/linkedin/Liger-Kernel) Kernel for LLM model training. It can effectively increase multi-GPU training throughput by ~20% and reduces memory usage by ~60%, works out of the box with flash attention, PyTorch FSDP, and Microsoft DeepSpeed. Currently, it supports llama, mistral, mixtral and gemma models. liger_kernel_config (`Optional[dict]`, *optional*): Configuration to be used for Liger Kernel. When use_liger_kernel=True, this dict is passed as keyword arguments to the `_apply_liger_kernel_to_instance` function, which specifies which kernels to apply. Available options vary by model but typically include: 'rope', 'swiglu', 'cross_entropy', 'fused_linear_cross_entropy', 'rms_norm', etc. If `None`, use the default kernel configurations. average_tokens_across_devices (`bool`, *optional*, defaults to `True`): Whether or not to average tokens across devices. If enabled, will use all_reduce to synchronize num_tokens_in_batch for precise loss calculation. Reference: https://github.com/huggingface/transformers/issues/34242 )accelerator_config fsdp_config deepspeedgradient_checkpointing_kwargslr_scheduler_kwargsptNhelpzThe output directory where the model predictions and checkpoints will be written. Defaults to 'trainer_output' if not provided.)rNmetadata output_dirFz|Overwrite the content of the output directory. Use this to continue training if output_dir points to a checkpoint directory.overwrite_output_dirzWhether to run training.do_trainz#Whether to run eval on the dev set.do_evalz+Whether to run predictions on the test set. do_predictnozThe evaluation strategy to use. eval_strategyzBWhen performing evaluation and predictions, only returns the loss.prediction_loss_onlyz8Batch size per device accelerator core/CPU for training.per_device_train_batch_sizez:Batch size per device accelerator core/CPU for evaluation.per_device_eval_batch_sizezrDeprecated, the use of `--per_device_train_batch_size` is preferred. Batch size per GPU/TPU core/CPU for training.per_gpu_train_batch_sizezsDeprecated, the use of `--per_device_eval_batch_size` is preferred. Batch size per GPU/TPU core/CPU for evaluation.per_gpu_eval_batch_sizerzONumber of updates steps to accumulate before performing a backward/update pass.gradient_accumulation_stepszONumber of predictions steps to accumulate before moving the tensors to the CPU.eval_accumulation_stepsrzsNumber of epochs or steps to wait for before the first evaluation can be performed, depending on the eval_strategy. eval_delaya.Number of steps to wait before calling `torch..empty_cache()`.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).If left unset or set to None, cache will not be emptied.torch_empty_cache_steps-C6 ?z$The initial learning rate for AdamW. learning_rategz(Weight decay for AdamW if we apply some. weight_decay?zBeta1 for AdamW optimizer adam_beta1+?zBeta2 for AdamW optimizer adam_beta2:0yE>zEpsilon for AdamW optimizer. adam_epsilong?zMax gradient norm. max_grad_norm@z+Total number of training epochs to perform.num_train_epochsr/zQIf > 0: set total number of training steps to perform. Override num_train_epochs. max_stepslinearzThe scheduler type to use.lr_scheduler_typezbExtra parameters for the lr_scheduler such as {'num_cycles': 1} for the cosine with hard restarts.)default_factoryrrz8Linear warmup over warmup_ratio fraction of total steps. warmup_ratioz Linear warmup over warmup_steps. warmup_stepsr.zLogger 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 anything and lets the application set the level. Defaults to 'passive'.)rchoices log_levelwarningzTLogger log level to use on replica nodes. Same choices and defaults as ``log_level``log_level_replicaTzhWhen doing a multinode distributed training, whether to log once per node or just once on the main node.log_on_each_nodezTensorboard log dir. logging_dirstepszThe logging strategy to use.logging_strategyzLog the first global_steplogging_first_stepzLog 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. logging_stepsz&Filter nan and inf losses for logging.logging_nan_inf_filterz$The checkpoint save strategy to use. save_strategyzSave 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_stepsakIf a value is passed, will limit the total amount of checkpoints. Deletes the older checkpoints in `output_dir`. When `load_best_model_at_end` is enabled, the 'best' checkpoint according to `metric_for_best_model` will always be retained in addition to the most recent ones. For example, for `save_total_limit=5` and `load_best_model_at_end=True`, the four last checkpoints will always be retained alongside the best model. When `save_total_limit=1` and `load_best_model_at_end=True`, it is possible that two checkpoints are saved: the last one and the best one (if they are different). Default is unlimited checkpointssave_total_limitz`Use safetensors saving and loading for state dicts instead of default torch.load and torch.save.save_safetensorszxWhen doing multi-node distributed training, whether to save models and checkpoints on each node, or only on the main onesave_on_each_nodeaWWhen checkpointing, whether to only save the model, or also the optimizer, scheduler & rng state.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.save_only_modelzWhether to restore the callback states from the checkpoint. If `True`, will override callbacks passed to the `Trainer` if they exist in the checkpoint.'restore_callback_states_from_checkpointuTThis argument is deprecated. It will be removed in version 5.0 of 🤗 Transformers.no_cudazsWhether or not to use cpu. If left to False, we will use the available torch device/backend (cuda/mps/xpu/hpu etc.)use_cpuuThis argument is deprecated. `mps` device will be used if available similar to `cuda` device. It will be removed in version 5.0 of 🤗 Transformersuse_mps_device*z:Random seed that will be set at the beginning of training.seedz*Random seed to be used with data samplers. data_seedz5Whether or not to use PyTorch jit trace for inference jit_mode_evalzWhether 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.bf16z7Whether to use fp16 (mixed) precision instead of 32-bitfp16O1zFor fp16: Apex AMP optimization level selected in ['O0', 'O1', 'O2', and 'O3']. See details at https://nvidia.github.io/apex/amp.htmlfp16_opt_levelautoz*The backend to be used for half precision.)rapexcpu_amphalf_precision_backendziWhether to use full bfloat16 evaluation instead of 32-bit. This is an experimental API and it may change.bf16_full_evalz8Whether to use full float16 evaluation instead of 32-bitfp16_full_evalz|Whether to enable tf32 mode, available in Ampere and newer GPU architectures. This is an experimental API and it may change.tf32z$For distributed training: local_rank local_rankz/The backend to be used for distributed training)ncclgloompicclhcclcnclmccl ddp_backendzBTPU: Number of TPU cores (automatically passed by launcher script) tpu_num_coreszdDeprecated, the use of `--debug tpu_metrics_debug` is preferred. TPU: Whether to print debug metricstpu_metrics_debugrzWhether or not to enable debug mode. Current options: `underflow_overflow` (Detect underflow and overflow in activations and weights), `tpu_metrics_debug` (print debug metrics on TPU).debugzHDrop the last incomplete batch if it is not divisible by the batch size.dataloader_drop_lastzRun an evaluation every X 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. eval_stepszxNumber of subprocesses to use for data loading (PyTorch only). 0 means that the data will be loaded in the main process.dataloader_num_workerszNumber of batches loaded in advance by each worker. 2 means there will be a total of 2 * num_workers batches prefetched across all workers. dataloader_prefetch_factorzRIf >=0, uses the corresponding part of the output as the past state for next step. past_indexzfAn optional descriptor for the run. Notably used for trackio, wandb, mlflow comet and swanlab logging.run_namez1Whether or not to disable the tqdm progress bars. disable_tqdmzCRemove columns not required by the model when using an nlp.Dataset.remove_unused_columnszLThe list of keys in your dictionary of inputs that correspond to the labels. label_nameszWhether or not to load the best model found during training at the end of training. When this option is enabled, the best checkpoint will always be saved. See `save_total_limit` for more.load_best_model_at_endz2The metric to use to compare two different models.metric_for_best_modelz?Whether the `metric_for_best_model` should be maximized or not.greater_is_betterzmWhen resuming training, whether or not to skip the first epochs and batches to get to the same training data.ignore_data_skipaWhether or not to use PyTorch Fully Sharded Data Parallel (FSDP) training (in distributed training only). The base option should be `full_shard`, `shard_grad_op` or `no_shard` and you can add CPU-offload to `full_shard` or `shard_grad_op` like this: full_shard offload` or `shard_grad_op offload`. You can add auto-wrap to `full_shard` or `shard_grad_op` with the same syntax: full_shard auto_wrap` or `shard_grad_op auto_wrap`.fsdpzThis parameter is deprecated. FSDP's minimum number of parameters for Default Auto Wrapping. (useful only when `fsdp` field is passed).fsdp_min_num_paramszConfig to be used with FSDP (Pytorch Fully Sharded Data Parallel). The value is either a fsdp json config file (e.g., `fsdp_config.json`) or an already loaded json file as `dict`.rzThis parameter is deprecated. Transformer layer class name (case-sensitive) to wrap, e.g, `BertLayer`, `GPTJBlock`, `T5Block` .... (useful only when `fsdp` flag is passed)."fsdp_transformer_layer_cls_to_wrapzConfig to be used with the internal Accelerator object initialization. The value is either a accelerator json config file (e.g., `accelerator_config.json`) or an already loaded json file as `dict`.rzLParallelism configuration for the training run. Requires Accelerate `1.10.1`parallelism_configzEnable deepspeed and pass the path to deepspeed json config file (e.g. `ds_config.json`) or an already loaded json file as a dictrzEThe label smoothing epsilon to apply (zero means no label smoothing).label_smoothing_factorr_)"is_torch_greater_or_equal_than_2_8r`zThe optimizer to use.optimz*Optional arguments to supply to optimizer. optim_argsz-Whether or not to replace AdamW by Adafactor.rdzRWhether or not to group samples of roughly the same length together when batching.group_by_lengthlengthzDColumn name with precomputed lengths to use when grouping by length.length_column_namez;The list of integrations to report the results and logs to. report_to huggingfacezKThe name of the project to use for logging. Currenly, only used by Trackio.projecttrackioaThe Hugging Face Space ID to deploy to when using Trackio. Should be a complete Space name like 'username/reponame' or 'orgname/reponame', or just 'reponame' in which case the Space will be created in the currently-logged-in Hugging Face user's namespace. If `None`, will log to a local directory. Note that this Space will be public unless you set `hub_private_repo=True` or your organization's default is to create private Spaces.trackio_space_idztWhen using distributed training, the value of the flag `find_unused_parameters` passed to `DistributedDataParallel`.ddp_find_unused_parameterszkWhen using distributed training, the value of the flag `bucket_cap_mb` passed to `DistributedDataParallel`.ddp_bucket_cap_mbzoWhen using distributed training, the value of the flag `broadcast_buffers` passed to `DistributedDataParallel`.ddp_broadcast_buffersz,Whether or not to pin memory for DataLoader.dataloader_pin_memoryzIf True, the data loader will not shut down the worker processes after a dataset has been consumed once. This allows to maintain the workers Dataset instances alive. Can potentially speed up training, but will increase RAM usage.dataloader_persistent_workerszDWhether or not to skip adding of memory profiler reports to metrics.skip_memory_metricsz@Whether or not to use the legacy prediction_loop in the Trainer.use_legacy_prediction_loopzKWhether or not to upload the trained model to the model hub after training. push_to_hubz|_tA|jB|_!tE|jF|_#tI|jJ|_%|jLdur$|j,t<jNk7rd|_&|jPBt |jPtRr|jPdkDstUd |jPd |j,t<jVk(rw|jX|jXdk(r\|jZdkDr4tjd |jZ|jZ|_,ntUd |j,d |j>t<jVk(r(|jZdk(rtUd|j>d|j>t<jVk(rc|jZdkDrT|jZtS|jZk7rtUd|jZtS|jZ|_-|j,t<jVk(rc|jXdkDrT|jXtS|jXk7rtUd|jXtS|jX|_,|jBt@jVk(rc|j\dkDrT|j\tS|j\k7rtUd|j\tS|j\|_.|j^rg|jBt@j`k7rI|j,|jBk7r%tUd|j,d|jB|j,t<jVk(r|j\|jXzdk7r|jXdks|j\dkr|jXdkr|j\dks&tUd|j\d|jXd d}|j\|z|jX|zzdk7rLtUd|j\d|jXd tUd|j\d|jXd |jbs#tjd|jbd|j^s|jJtHjdk(r|jfd|_3|jh-|jf!|jfjkd |_4|jld k(rtor|jpr:|jpd!k7r+t1j2d"t4|jp|_9|jts |jvrg|j:rtostys tUd#|j:s0t{s&tysd$}t}r|d%z }tU||j~r|jtr tUd&|jr|jvr tUd'|jtr|jrd(k(r tUd)|jrd(k(rts td* dd+lCmD}|jJtHjdk(r=|j,t<jNk(r tUd.tos tUd/t|j|_F|jr/t1j2d0t4tj|_Ftrt |jts|jt|_Jn~t |jtrtdi|j|_JnIt |jtr td1tj|j|_J|jjrtjd2|jld k(rtor |j|j+t1j2d3t4|j|_S|j |j|jsd|_U|jr1|j%|j:strd4|_Snd5|_S|jrNd6}|jtj|d7z<|j |jtj|d8z<|jld k(rtor|jrtr|j |j~r |jtrtrd9nd:} tjd;| d<tr dtjj_^n^dtjjj_^dtjj_^ntjd=|jld k(r(tor|j|jrtrstr dtjj_^ndtjjj_^dtjj_^ntUd>trrtr dtjj_^nHdtjjj_^dtjj_^tjjd?d@} |j~rdA} n|jtrdB} | tjd?<|jtjdCdD|_d|jdDk(s|jdDgk(rkddElemf} | |_ddF|jvrtjjrtjdG|jjdFnS|jdHk(s|jdHgk(rg|_dn,t |jts|jg|_d|jdks|jdkDr tUdI|jdkDr$|jdkDrtjdJt |jtRr|jdkr tUdK|jg|_mnu|jdurtjg|_mnPt |jt r6|jjD cgc] } t| c} |_m|jtjgk(r tUdLtj|jvr'tj|jvr tUdM|jrMtj|jvstj|jvrtjdN|ji|_ut |jt rgt|jdk(rt1j2dOt|jdPQ5} tj| |_uddd|jt |jtrgt|jjD]A}|jdRs|jj|}||j|dSd<C|jdkDrt1j2dTt4t|jjdUd|j|jdU<t |jjdVdt r|jdVg|jdV<|jQt1j2dWt4|jjdVg|jgz|jdV<t|jdk(r'|jdUdkDrt1j2dXt|jdk(r1|jjdVdt1j2dYt|jdkDr9|jdUdkDr'|jjdVd tUdZ|jjd[d|jd[<|jjd\d|jd\<|jjd]d|jd]<|jd[rt|jdkDr|jjd^ij|_d_|jvr*t t|jd_|jd_<d`|jvret t|jd`|jd`<n:t1j2dan$|jd]rt1j2dbt|jdkDr|jd[sdctjdd<ddelm}m}df}|jD]Y}|j|vrBt |j |jdztj|dg<Y|tjk(rdctj|dh<|tj k(s|dtj|di<|jdUdkDrGt |jdUtj|dj<|dtj|di< |jjdVd(dkj!|jdVtj|dl<\|jjdmdn}|jtj|do<t |jjdpdqj tj|dr<t |jjdsdcj }t |jjdtdqj }|dqk(r|dck(r tUdu|tj|dv<|tj|dw<t |jjdxdcj tj|dy<|jrLt1j2dzt4|jd{|_n|xjd{z c_d|_t |jt r9|jjD cgc]} t| c} |_n|jg|_d|_|jrtstUd|td}dd~lm}||j|_|jj!|ddlm}dctjd<||j|_nt'tjjddqrkddlm}||_tjjd?d@}|jj)||jj+|jrd(k7rPtjjd?d@} |j~rdA} n|jtrdB} | tjd?<|j:rd|_|j.dk(r|j0 tUd|j2,t1j2dt4|j2|_|j6t9|j6|j:|j4|_|j:*t1j2d|j<dt4nt1j2d|j<dt4nl|j:_|j:dt?|jj@|_t1j2d|j<dt4|jBrtds tUd|jDtds td|jFr2tjd|jHjKd|jLdurdD|_y|jLdurd@|_yy#t$r}td,|d-d}~wwxYwcc} w#1swY xYwcc} w)Ntrainer_outputzNo output directory specified, defaulting to 'trainer_output'. To change this behavior, specify --output_dir when creating TrainingArguments.{uusing `EvaluationStrategy` for `eval_strategy` is deprecated and will be removed in version 5 of 🤗 Transformers. Use `IntervalStrategy` insteadulusing `no_cuda` is deprecated and will be removed in version 5.0 of 🤗 Transformers. Use `use_cpu` insteadFTrz@`torch_empty_cache_steps` must be an integer bigger than 0, got rz4using `logging_steps` to initialize `eval_steps` to zevaluation strategy z9 requires either non-zero --eval_steps or --logging_stepszlogging strategy z" requires non-zero --logging_stepsrz5--logging_steps must be an integer if bigger than 1: z2--eval_steps must be an integer if bigger than 1: z2--save_steps must be an integer if bigger than 1: zh--load_best_model_at_end requires the save and eval strategy to match, but found - Evaluation strategy: z - Save strategy: z--load_best_model_at_end requires the saving steps to be a multiple of the evaluation steps, which cannot get guaranteed when mixing ratio and absolute steps for save_steps z and eval_steps i@Bzg--load_best_model_at_end requires the saving steps to be a multiple of the evaluation steps, but found z, which is not a multiple of zm--load_best_model_at_end requires the saving steps to be a round multiple of the evaluation steps, but found z#, which is not a round multiple of z7Found safetensors installation, but --save_safetensors=z. Safetensors should be a preferred weights saving format due to security and performance reasons. If your model cannot be saved by safetensors please feel free to open an issue at https://github.com/huggingface/safetensors!lossrrux`fp16_backend` is deprecated and will be removed in version 5 of 🤗 Transformers. Use `half_precision_backend` insteadzLYour setup doesn't support bf16/(cpu, tpu, neuroncore). You need torch>=1.10z$Your setup doesn't support bf16/gpu.z% You need Ampere+ GPU with cuda>=11.0z6At most one of fp16 and bf16 can be True, but not bothzDAt most one of fp16 and bf16 can be True for full eval, but not bothrzD `--half_precision_backend apex`: GPU bf16 is not supported by apex.zcUsing FP16 with APEX but APEX is not installed, please refer to https://www.github.com/nvidia/apex.)ampzIapex.amp is deprecated in the latest version of apex, causing this error z. Either revert to an older version or use pytorch amp by setting half_precision_backend='auto' instead. See https://github.com/NVIDIA/apex/pull/1896 z@lr_scheduler_type reduce_lr_on_plateau requires an eval strategyz=0.2.0ur`--adafactor` is deprecated and will be removed in version 5 of 🤗 Transformers. Use `--optim adafactor` insteadzTried passing in a callable to `accelerator_config`, but this is not supported. Please pass in a fully constructed `AcceleratorConfig` object instead.zUsing `split_batches=True` in `accelerator_config` will override the `per_device_train_batch_size` Batches will be split across all processes equally when using `split_batches=True`.uv`torchdynamo` is deprecated and will be removed in version 5 of 🤗 Transformers. Use `torch_compile_backend` instead hpu_backendinductorACCELERATE_DYNAMO_BACKENDMODEMUSACUDAzSetting TF32 in zL backends to speedup torch compile, you won't see any improvement otherwise.zbThe speedups for torchdynamo mostly come with GPU Ampere or higher and which is not detected here.zC--tf32 requires Ampere or a newer GPU arch, cuda>=11 and torch>=1.7ACCELERATE_MIXED_PRECISIONrrra The default value for the training argument `--report_to` will change in v5 (from all installed integrations to none). In v5, you will need to use `--report_to all` to get the same behavior as now. You should start updating your code and make this info disappear :-).all)$get_available_reporting_integrations codecarbonaRWhen using the Trainer, CodeCarbonCallback requires the `codecarbon` package, which is not compatible with AMD ROCm (https://github.com/mlco2/codecarbon/pull/490). Automatically disabling the codecarbon callback. Reference: https://huggingface.co/docs/transformers/v4.39.3/en/main_classes/trainer#transformers.TrainingArguments.report_to.nonez$warmup_ratio must lie in range [0,1]zoBoth warmup_ratio and warmup_steps given, warmup_steps will override any effect of warmup_ratio during trainingzEwarmup_steps must be of type int and must be 0 or a positive integer.z`--fsdp offload` can't work on its own. It needs to be added to `--fsdp full_shard` or `--fsdp shard_grad_op`. For example, `--fsdp "full_shard offload"`.zB`--fsdp full_shard` is not compatible with `--fsdp shard_grad_op`.aWhen using FSDP full shard, instead of using `gradient_checkpointing` in TrainingArguments, please use `activation_checkpointing` in `fsdp_config`. The former introduces a redundant AllGather operation in backward pass. Reference: https://github.com/huggingface/transformers/issues/30404z:`--fsdp_config` is useful only when `--fsdp` is specified.zutf-8)encodingfsdp_zEusing `--fsdp_min_num_params` is deprecated. Use fsdp_config instead min_num_paramstransformer_layer_cls_to_wrapzTusing `--fsdp_transformer_layer_cls_to_wrap` is deprecated. Use fsdp_config instead z;`min_num_params` is useful only when `--fsdp` is specified.zJ`transformer_layer_cls_to_wrap` is useful only when `--fsdp` is specified.zL`min_num_params` and `transformer_layer_cls_to_wrap` are mutually exclusive.r7 xla_fsdp_v2xla_fsdp_grad_ckptxla_fsdp_settings compute_dtype buffer_dtypez5XLA FSDP can be used only when `--fsdp` is specified.zB`--xla_fsdp_grad_ckpt` is useful only when `--xla` is set to true.rACCELERATE_USE_FSDP)FSDP_AUTO_WRAP_POLICYFSDP_SHARDING_STRATEGYFSDP_SHARDING_STRATEGYOFFLOAD_PARAMSAUTO_WRAP_POLICYMIN_NUM_PARAMS,TRANSFORMER_CLS_TO_WRAPbackward_prefetch NO_PREFETCHBACKWARD_PREFETCHforward_prefetchrFORWARD_PREFETCHsync_module_statescpu_ram_efficient_loadingzP`sync_module_states` must be `"True"` if `cpu_ram_efficient_loading` is `"True"`SYNC_MODULE_STATESCPU_RAM_EFFICIENT_LOADINGuse_orig_paramsUSE_ORIG_PARAMSuusing `--tpu_metrics_debug` is deprecated and will be removed in version 5 of 🤗 Transformers. Use `--debug tpu_metrics_debug` insteadz tpu_metrics_debugzK--deepspeed requires Accelerate to be installed: `pip install 'accelerate>=z'`.)HfTrainerDeepSpeedConfig)DeepSpeedPluginACCELERATE_USE_DEEPSPEED) hf_ds_configz--dataloader_prefetch_factor can only be set when data is loaded in a different process, i.e. when --dataloader_num_workers > 1.uu`--push_to_hub_token` is deprecated and will be removed in version 5 of 🤗 Transformers. Use `--hub_token` instead.) organizationtokenu`--push_to_hub_model_id` and `--push_to_hub_organization` are deprecated and will be removed in version 5 of 🤗 Transformers. Use `--hub_model_id` instead and pass the full repo name to this argument (in this case z).u`--push_to_hub_model_id` is deprecated and will be removed in version 5 of 🤗 Transformers. Use `--hub_model_id` instead and pass the full repo name to this argument (in this case /u`--push_to_hub_organization` is deprecated and will be removed in version 5 of 🤗 Transformers. Use `--hub_model_id` instead and pass the full repo name to this argument (in this case z0.30.0z--eval_use_gather_object requires Accelerate to be version of `accelerate` > 0.30.0.This is not supported and we recommend you to update your version.z1.1.0zdata_seed requires Accelerate version `accelerate` >= 1.1.0. This is not supported and we recommend you to update your version.uUsing `include_inputs_for_metrics` is deprecated and will be removed in version 5 of 🤗 Transformers. Please use `include_for_metrics` list argument instead.inputsr)rloggerinfo_VALID_DICT_FIELDSgetattrrr startswithjsonloadsrsetattrrArB expanduserrrCrGr-getEffectiveLevelr*WARNrrwarningswarn FutureWarningrr r rrrrrrOrrrNOrrJ ValueErrorSTEPSr(rrr0BESTrREDUCE_ON_PLATEAUr1r2endswith frameworkrrXrrrr(rr rrr ImportErrorrrwr^r:rdrrrr3rrXNotImplementedErrorfrom_json_file split_batchesrRrbrgrhrfr!rKr'rr$torchbackendsmudnn allow_tf32cudamatmulcudnnrrLr? integrationsrversionhipremovelistrrr4r FULL_SHARDr[OFFLOAD SHARD_GRAD_OPrT HYBRID_SHARDrlenopenloadkeyspopr5maxr6copyxla_fsdp_configaccelerate.utils.constantsrrupperindex AUTO_WRAPrr%r&rdeepspeed_pluginrr#transformers.integrations.deepspeedrhf_deepspeed_configtrainer_config_processaccelerate.utilsrr,set_mixed_precisionset_deepspeed_weakrefrGr)r*r[rPrYrrZrMr namerqrrUrVappendrj)selfrr loaded_dictLARGE_MULTIPLIER error_messagerwrOprefix device_strmixed_precision_dtypersfkvrr fsdp_optionprefetch_policyrrrrmixed_precisions rF __post_init__zTrainingArguments.__post_init__:sz ?? ".DO KKa  ,, 2E"4/L,,1H1H1M"jj6 / < e[1 2 ?? & gg00ADO    #(C!ww||DOO^=MND     '!ww11$2B2BCD     $ & 8 8 :W\\ ID  d((*< = MMH  "&!3!3!9!9D  << MM(   <?''  $4$:$: :t?Q?QUV?V01F1F0GGijk k  $4$:$: :t?Q?QTU?U!!S););%<< #XY]YkYkXl!mnn!$T%7%7!8D    !1!7!7 7DOOa?   ' '4+A+A]EdEd+d((0)/D &  ! ! )d.H.H.T)-)C)C)L)LV)T%TD " >>T !&8&:  T%6%6&%@ 8! /3.?.?+yyD//<<(:(> MM&  (11DJ # $d557HI**2.?.AD+ 7 7>.?.Z$BYBY.ZD+  7 7>-a /@.N.NtOfOf.gD+&&44 j >>T !&8&: KK    ' MM3  *.)9)9D &  # # /43M3M3Ycgcucu!%D    $"<"<"D<<$:$<-:*-7*   )F-1-G-GBJJv ) *&&2.2.E.E 6F?+ >>T !&8&:t?Q?Q&(99$TYY$))+B+D&JKK*:,7&&/0:>,,7@D++22=:>,,7x >>T !&8&:tyy?Tyy*,.0:>,,7@D++22=:>,,7$%jkk*,.0:?,,7@E++22=:?,,7!# /KT R 99$* ! YY$* !3H /0 >> ! KK]  #DN >>U "dnn&? JACDNt~~-%--2C2Ci%%l3 ^^v %F8)CDNDNND1"nn-DN   q D$5$5$9CD D    "t'8'81'< KK#  $++S1T5F5F5Jde e 99 DI YY$ #../DI  3 '04 0AB1ABDI 99++, ,V  " "dii /J4L4LPTPYPY4Yab b  & &  ! !TYY .*2I2ITYY2V NNs     #!D  d&& ,499~" Z[d&&9 0Q#'99Q<  0    'Jt7G7G,N$**//12 0<<(((,,Q/A./D$$QqrU+ 0  # #a ' MMacp q-01A1A1E1EFVXY1Z\`\t\t-u)* d&&**+JDQSV WAEAQAQRqAr@sD  < =  2 2 > MMfhu AE@P@P@T@T/A889A:D  < = tyy>Q 4#3#34D#E#I MMW X tyy>Q 4#3#3#7#78WY]#^#j MMf g  NQ   !12Q6  $$%DdKWkl l"&"2"2"6"6ue"D*.*:*:*>*>}e*T'151A1A1E1EFZ\a1b-.   E "499~!(,'7'7';';A d&6&6u&=06BJJ, -  F#yy  $$&*@@?B.44[5F5F5HIAM@BJJ&):;<!J$6$66STU>VBJJ&)9:;''(89A=@CDDTDTUeDf@g fX^#<=BWXYBZ fX-=#>?))--.MtT`IL ,,-LMJ fX-D#EF "#..223F VO7F7L7L7NBJJ&!23 469$:J:J:N:NOacj:k6l6r6r6tBJJ&!12 3!$T%5%5%9%9:NPV%W!X!^!^!` (+D,<,<,@,@A\^e,f(g(m(m(o %!W,1Jf1T!!stt8JBJJ&!34 5?XBJJ&!:; <589I9I9M9MN_ag9h5i5o5o5qBJJ&1 2  ! ! MM7  zz!1  22 %*D " djj# &26**2B2B2DEQ+a.EDJ ZZ DJ $ >>+, abxayy|} U(@'OD $  $ $ ; ;D A 95;BJJ1 2$3AYAY$ZD ! rzz~~&@'J K 8$3$5D ! jjnn-I4PO  ! ! 5 5o F  ! ! 7 7 9  & && 0$&JJNN3OQU$V !yy(.%(.%7LBJJ3 4 <<).D &  & &! +0O0O0[6   ! ! - MM)  "33DN  $ $ 0 2))8U8U]a]k]k!D ,,8 ..2.?.?-@D"  k(()-"   * * 6#'#@#@"A4CXC]C]B^ _D  MMg$$%R)    & &/Fx/PU  >> %*73)Y  * * NNr   $ $ + +H 5  - - 516D .  / /5 815D .9_  !_`a_bcyz rC2 0 0bFs?7AuAAu5FAu:eAvu Au2uAu-u-Au2u:Avct|}|d=|d=|jDcic]-\}}||jdrd|jdn|/}}}t |jDcgc] \}}|d|d}}}|j j dd j|d Scc}}wcc}}w) Nrr_token<>=z, z( r))rrrrsorted __class__rrC)r self_as_dictrr attrs_as_strs rF__str__zTrainingArguments.__str__ysd|  3 4 2 3WcWiWiWkltqRSqzz(/CQqwwyk+Jl l289K9K9M2NO$!Q1#Qqc O O..))*#bggl.C-DAFFmOs 2B66B<r9c|jrtjd|jxs |j}|t d|j z}|S)zz The actual batch size for training (may differ from `per_gpu_train_batch_size` in distributed training). zUsing deprecated `--per_gpu_train_batch_size` argument which will be removed in a future version. Using `--per_device_train_batch_size` is preferred.r)rrrrrn_gpu)rper_device_batch_sizetrain_batch_sizes rFrz"TrainingArguments.train_batch_sizesT  ( ( NNO !% = = aAaAa03q$**3EErHc|jrtjd|jxs |j}|t d|j z}|S)z{ The actual batch size for evaluation (may differ from `per_gpu_eval_batch_size` in distributed training). zUsing deprecated `--per_gpu_eval_batch_size` argument which will be removed in a future version. Using `--per_device_eval_batch_size` is preferred.r)rrrrrr)rreval_batch_sizes rFrz!TrainingArguments.eval_batch_sizesS  ' ' NNN !% < < _@_@_/#a2DDrHc.t|jS)zt The actual timeout for torch.distributed.init_process_group since it expects a timedelta variable. seconds)rrers rFddp_timeout_deltaz#TrainingArguments.ddp_timeout_deltas !1!122rHc t|dgtjdts$t st dt dt dddd}t|jtr|jjd d|d <|d rwtjik(r td t|j |_|j rO|jj"t$j&k7r(t)d t+j,d d|_dt.j0vrdt.j0d<d|_|js)t5t.j0j7ddrd|d<|j8|d<d|_ntrOd|d<t;j<}t?j@d|}t>jBjE|nctGrd|d<nS|j rd|d<tI|jJ|d<n(|j8|d<tI|jJ|d<|jddr\|jd dsJ|jdd}|rdt.j0d<td+i||_|rt.j0d=ts1|jj@}|jjL|_tOjPrFtOjRr2|jTtVjXk7rtj[dt]r|jj@}d|_|StGs tr S|jj"t$j^k(r|j`r/tcjddjfd k7r td!|jrt?j@d}|Stirt?j@d }|StkrVtmst d"s t d#t?j@d$}t>jnjE||Stqr6t?j@d%}t>jrjE||Stur6t?j@d&}t>jvjE||Styr6t?j@d'}t>jzjE||St}r6t?j@d(}t>j~jE||St?j@t>jBjQrd)nt.j0j7d*d}t>jBj|_|jfdk(rt>jBjE|S),NrzPyTorch: setting up devicesz9Using the `Trainer` with `PyTorch` requires `accelerate>=zM`: Please run `pip install transformers[torch]` or `pip install 'accelerate>=z'`TF)enableduse_configured_staterzPassing `'use_configured_state':True` to the AcceleratorConfig requires a pre-configured `AcceleratorState` or `PartialState` to be defined before calling `TrainingArguments`. )rUaTried to use an already configured `Accelerator` or `PartialState` that was not initialized for DeepSpeed, but also passed in a `deepspeed` configuration to the `TrainingArguments`. Please set `use_configured_state:False` instead or setup your `Accelerator` or `PartialState` properly.)reset_partial_stateACCELERATE_USE_IPEXrrACCELERATE_USE_CPUFalserUr8rrr_use_sagemaker_dp use_deepspeedr timeoutrrztorch.distributed process group is initialized, but parallel_mode != ParallelMode.DISTRIBUTED. In order to use Torch DDP, launch your script with `python -m torch.distributed.launchu`use_mps_device` is deprecated and will be removed in version 5.0 of 🤗 Transformers. `mps` device will be used by default if available similar to the way `cuda` device is used.Therefore, no action from user is required. mpszEither you do not have an MPS-enabled device on this machine or MacOS version is not 12.3+ or current PyTorch install was not built with MPS enabled.z 0.32.0.devz?Using the XPU PyTorch backend requires `accelerate>=0.32.0.dev`zxpu:0zmlu:0zmusa:0znpu:0zhpu:0zcuda:0ACCELERATE_TORCH_DEVICEr)Ar+rrrrrrrrr3rr1 _shared_staterr distributed_staterdistributed_typer2 DEEPSPEED RuntimeErrorr0 _reset_staterArKr^r,rLr#smprrrRr set_devicerrrelocal_process_indexdist is_availableis_initialized parallel_mode ParallelMode DISTRIBUTEDrr(rr rrrXr#r)rxpur"mlur$musar&npur!hpu device_count)raccelerator_state_kwargsrrRrs rF_setup_devicesz TrainingArguments._setup_devicessE$ * 12&(*,!OPfOghaaw`xxz| @D]b3c d--/@ A?C?V?V?Z?Z&@ $%; < $$: ;))R/ n &2dll%CD "~~$"8"8"I"I_MfMf"f"s  ) )d C%)D "  207BJJ, - <<9RZZ^^4H'%RS.2 $U +262B2B $Y /DK $ &27 $Y /)J\\&*5F JJ ! !& ) $ &<@ $%8 9 ^^8< $_ 52;DDTDT2U $Y /262B2B $Y /2;DDTDT2U $Y / $ ' ' 5 9BZB^B^ "EC 588%PM9? 56%1%M4L%MD "JJ9:&(++22F"44HHDO    4#6#6#8T=O=OS_SkSk=k NNi  " #++22FDKh g% &*A*C b a # # 4 48J8J J"" C ;;%'$U||e,F E()e,B A()(*3J<3X%&ghhg. $$V,8 7()g. $$V,2 1)*h/ %%f-, +()g. $$V,& %()g. $$V,   % 7 7 9Hrzz~~Ngin?o $jj557 ;;&(JJ))&1 rHc4t|dg|jS)z2 The device used by this process. r)r+r0r s rFrRzTrainingArguments.device- s $ *"""rHcdt|dgt|ds |j}|jS)a The number of GPUs used by this process. Note: This will only be greater than one when you have multiple GPUs available but are not using distributed training. For distributed training, it will always be 1. rr^)r+hasattrr0r^)rr=s rFrzTrainingArguments.n_gpu5 s/ $ *tX&##A{{rHct|dgtrtjSt rtj St rtjS|j'|jjtjk7s|j|jdk7rtjS|jdkDrtjStj S)a The current mode used for parallelism if multiple GPUs/TPU cores are available. One of: - `ParallelMode.NOT_PARALLEL`: no parallelism (CPU or one GPU). - `ParallelMode.NOT_DISTRIBUTED`: several GPUs in one single process (uses `torch.nn.DataParallel`). - `ParallelMode.DISTRIBUTED`: several GPUs, each having its own process (uses `torch.nn.DistributedDataParallel`). - `ParallelMode.TPU`: several TPU cores. rr/r)r+r(r'TPUrSAGEMAKER_MODEL_PARALLELrSAGEMAKER_DATA_PARALLELrrr2rrr(rNOT_DISTRIBUTED NOT_PARALLELr s rFr&zTrainingArguments.parallel_modeD s $ * ! ### # $ &88 8 $ &77 7  " " .43I3I3Z3Z^m^p^p3p$$,B1F++ + ZZ!^// /,, ,rHct|dg|j|jjStrLtj j jst jSt jSy)z; The number of processes used in parallel. rr) r+r num_processesrr statecfgprescaled_batchdp_sizerdp_sizer s rF world_sizezTrainingArguments.world_size_ ^ $ *  ! ! -))77 7 $ &(+ (E(E3;;= Y3<<> YrHct|dg|j|jjStrLtj j jst jSt jSy)z8 The index of the current process used. rr) r+r process_indexrr r<r=r>dp_rankrdp_rankr s rFrDzTrainingArguments.process_indexk rBrHct|dg|j|jjStrt j Sy)z6 The index of the local process used. rr)r+rr"rr rr s rFr"z%TrainingArguments.local_process_indexw sD $ *  ! ! -))== = $ &>># #rHc|jr|jdk(Strtjdk(S|j dk(S)zH Whether or not the current process should produce log. r)rr"rr rankrDr s rF should_logzTrainingArguments.should_log sE  ++q0 0&(xxzQ&))Q..rHc|jr|jdk(Strtjdk(S|j dk(S)zp Whether or not the current process should write to disk, e.g., to save models and checkpoints. r)rr"rr rIrDr s rF should_savezTrainingArguments.should_save sE  ! !++q0 0&(xxzQ&))Q..rHct|j}t|j}|dk(rtjn|}|dk(rtjn|}|j r|S|S)a` Returns the log level to be used depending on whether this process is the main process of node 0, main process of node non-0, or a non-main process. For the main process the log level defaults to the logging level set (`logging.WARNING` if you didn't do anything) unless overridden by `log_level` argument. For the replica processes the log level defaults to `logging.WARNING` unless overridden by `log_level_replica` argument. The choice between the main and replica process settings is made according to the return value of `should_log`. r/)trainer_log_levelsrrr* get_verbosityrJ)rrrlog_level_main_nodelog_level_replica_nodes rFget_process_log_levelz'TrainingArguments.get_process_log_level sg't~~6 .t/E/EF9Bbg335i %%1DID**@@tOeOeOuOu )*"%((*/ '&LLD$6$6#77IJ[I\\himhn!op-/ d+ "LLD$6$6#7r:K9LKX\W]]u!vw-/ d+  # #LLD$6$6#7r:K9LKX\W]]u!vw-/ d+  #s!A>F+A!E"A%F+A!F((F+num_training_stepsc|jdkDr|j}|Stj||jz}|S)z? Get number of steps used for a linear warmup. r)rmathceilr)rr`rs rFget_warmup_stepsz"TrainingArguments.get_warmup_steps sP "&!2!2Q!6D   =AIIFX[_[l[lFl %j7S.IQwZ..s3A6AgJXXZ /E%&''. /rHc\t|Dcic]0}|js|jt||j2}}|j D]8\}}t |t r|j||<t |tr>t|dkDr0t |dt r|Dcgc]}|jc}||<|jdrd|jd||<tr#t |tr|j||<|dk(rMt |tr=d|vr9|j!d}|r&t |ts|j||d<|dk(s"|&|j#||<;|j%||Scc}wcc}w)z Serializes this instance while replace `Enum` by their values (for JSON serialization support). It obfuscates the token values by removing their value. rrrrmodel_init_kwargsquantization_configr7)rr\rrrrrrrrrrrr3to_dictrrLto_jsonri)rrrerrxrls rFrmzTrainingArguments.to_dict sr AGt [uPUPZPZUZZuzz2 2 [ [GGI #DAq!T"ww!!T"s1vzj1t6L)*+A+!zz(#1779+Q'!&(Z;L-Myy{!''Jq$,?DY]^D^&'ee,A&B#&z:Mt/T2E2M2M2OAaD./((Q]yy{!! #$ "- \ ,sF$#F$0F)cLtj|jdS)z< Serializes this instance to a JSON string. )indent)rdumpsrmr s rFto_json_stringz TrainingArguments.to_json_string* szz$,,.33rHc^|j}i||j|jd}ttt t g}tr|jtj|jDcic] \}}|t||vr|n t |"c}}Scc}}w)zK Sanitized serialization to use with TensorBoard's hparams )rr) rmrrboolrJrrrrrTensorrrX)rre valid_typesrrs rFto_sanitized_dictz#TrainingArguments.to_sanitized_dict0 s LLN iq i)>)>SWSgSgh iS%-     u|| ,GHwwyQtq!Q;.1CF:QQQs%B) batch_size num_epochsc d|_||_||_||_||_||_||_||_||_|S)a A method that regroups all basic arguments linked to the training. Calling this method will automatically set `self.do_train` to `True`. Args: learning_rate (`float`, *optional*, defaults to 5e-5): The initial learning rate for the optimizer. batch_size (`int` *optional*, defaults to 8): The batch size per device (GPU/TPU core/CPU...) used for training. 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 the optimizer. num_train_epochs(`float`, *optional*, defaults to 3.0): Total number of training epochs to perform (if not an integer, will perform the decimal part percents of 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) until `max_steps` is reached. gradient_accumulation_steps (`int`, *optional*, defaults to 1): Number of updates steps to accumulate the gradients for, before performing a backward/update pass. 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. 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 model if it has some randomly initialized parameters. gradient_checkpointing (`bool`, *optional*, defaults to `False`): If True, use gradient checkpointing to save memory at the expense of slower backward pass. Example: ```py >>> from transformers import TrainingArguments >>> args = TrainingArguments("working_dir") >>> args = args.set_training(learning_rate=1e-4, batch_size=32) >>> args.learning_rate 1e-4 ``` T) rrrrrrrr rT) rrrzrr{rrr rTs rF set_trainingzTrainingArguments.set_training> sO@ *+5(( *"+F( &<# rHstrategyaccumulation_stepsdelay loss_onlyjit_modect||_|jtjk(r|dk(r td|jtjk7|_||_||_||_||_ ||_ ||_ |S)al A method that regroups all arguments linked to evaluation. Args: strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"no"`): The evaluation strategy to adopt during training. Possible values are: - `"no"`: No evaluation is done during training. - `"steps"`: Evaluation is done (and logged) every `steps`. - `"epoch"`: Evaluation is done at the end of each epoch. Setting a `strategy` different from `"no"` will set `self.do_eval` to `True`. steps (`int`, *optional*, defaults to 500): Number of update steps between two evaluations if `strategy="steps"`. batch_size (`int` *optional*, defaults to 8): The batch size per device (GPU/TPU core/CPU...) used for evaluation. accumulation_steps (`int`, *optional*): Number of predictions steps to accumulate the output tensors for, before moving the results to the CPU. If left unset, the whole predictions are accumulated on GPU/TPU before being moved to the CPU (faster but requires more memory). delay (`float`, *optional*): Number of epochs or steps to wait for before the first evaluation can be performed, depending on the eval_strategy. loss_only (`bool`, *optional*, defaults to `False`): Ignores all outputs except the loss. jit_mode (`bool`, *optional*): Whether or not to use PyTorch jit trace for inference. Example: ```py >>> from transformers import TrainingArguments >>> args = TrainingArguments("working_dir") >>> args = args.set_evaluate(strategy="steps", steps=100) >>> args.eval_steps 100 ``` rDSetting `strategy` as 'steps' requires a positive value for `steps`.) rrrrrrr(rrrrr)rr~rrzrrrrs rF set_evaluatezTrainingArguments.set_evaluate sb.h7   !1!7!7 7EQJcd d))-=-@-@@ *4''9$$-!% rHc>d|_||_||_||_|S)a[ A method that regroups all basic arguments linked to testing on a held-out dataset. Calling this method will automatically set `self.do_predict` to `True`. Args: batch_size (`int` *optional*, defaults to 8): The batch size per device (GPU/TPU core/CPU...) used for testing. loss_only (`bool`, *optional*, defaults to `False`): Ignores all outputs except the loss. jit_mode (`bool`, *optional*): Whether or not to use PyTorch jit trace for inference. Example: ```py >>> from transformers import TrainingArguments >>> args = TrainingArguments("working_dir") >>> args = args.set_testing(batch_size=32) >>> args.per_device_eval_batch_size 32 ``` T)rrrr)rrzrrs rF set_testingzTrainingArguments.set_testing s)D*4'$-!% rH total_limit on_each_nodect||_|jtjk(r|dk(r td||_||_||_|S)a A method that regroups all arguments linked to checkpoint saving. Args: strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"steps"`): The checkpoint save strategy to adopt during training. Possible values are: - `"no"`: No save is done during training. - `"epoch"`: Save is done at the end of each epoch. - `"steps"`: Save is done every `save_steps`. steps (`int`, *optional*, defaults to 500): Number of updates steps before two checkpoint saves if `strategy="steps"`. total_limit (`int`, *optional*): If a value is passed, will limit the total amount of checkpoints. Deletes the older checkpoints in `output_dir`. on_each_node (`bool`, *optional*, defaults to `False`): When doing multi-node distributed training, whether to save models and checkpoints on each node, or only on the main one. 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. Example: ```py >>> from transformers import TrainingArguments >>> args = TrainingArguments("working_dir") >>> args = args.set_save(strategy="steps", steps=100) >>> args.save_steps 100 ``` rr)rrrrrrr)rr~rrrs rFset_savezTrainingArguments.set_save sTR*(3   !3!3 3 cd d +!- rHlevel first_stepnan_inf_filter replica_levelc t||_|jtjk(r|dk(r td||_||_||_||_||_||_ ||_ |S)a A method that regroups all arguments linked to logging. Args: strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"steps"`): The logging strategy to adopt during training. Possible values are: - `"no"`: No logging is done during training. - `"epoch"`: Logging is done at the end of each epoch. - `"steps"`: Logging is done every `logging_steps`. steps (`int`, *optional*, defaults to 500): Number of update steps between two logs if `strategy="steps"`. 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"`, `"error"` and `"critical"`, plus a `"passive"` level which doesn't set anything and lets the application set the level. report_to (`str` or `list[str]`, *optional*, defaults to `"all"`): The list of integrations to report the results and logs to. Supported platforms are `"azure_ml"`, `"clearml"`, `"codecarbon"`, `"comet_ml"`, `"dagshub"`, `"dvclive"`, `"flyte"`, `"mlflow"`, `"neptune"`, `"swanlab"`, `"tensorboard"`, `"trackio"` and `"wandb"`. Use `"all"` to report to all integrations installed, `"none"` for no integrations. first_step (`bool`, *optional*, defaults to `False`): Whether to log and evaluate the first `global_step` or not. nan_inf_filter (`bool`, *optional*, defaults to `True`): Whether to filter `nan` and `inf` losses for logging. If set to `True` the loss of every step that is `nan` or `inf` is filtered and the average loss of the current logging window is taken instead. `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. on_each_node (`bool`, *optional*, defaults to `True`): In multinode distributed training, whether to log using `log_level` once per node, or only on the main node. replica_level (`str`, *optional*, defaults to `"passive"`): Logger log level to use on replicas. Same choices as `log_level` Example: ```py >>> from transformers import TrainingArguments >>> args = TrainingArguments("working_dir") >>> args = args.set_logging(strategy="steps", steps=100) >>> args.logging_steps 100 ``` rr) rrrrrr?rrrrr) rr~rr?rrrrrs rF set_loggingzTrainingArguments.set_logging st~!1 :  $4$:$: :uzcd d""",&4# ,!. rHmodel_idr private_repo always_pushrevisionczd|_||_t||_||_||_||_||_|S)am A method that regroups all arguments linked to synchronizing checkpoints with the Hub. Calling this method will set `self.push_to_hub` to `True`, which means the `output_dir` will begin a git directory synced with the repo (determined by `model_id`) and the content will be pushed each time a save is triggered (depending on your `self.save_strategy`). Calling [`~Trainer.save_model`] will also trigger a push. Args: model_id (`str`): The name of the repository to keep in sync with the local *output_dir*. It can be a simple model ID in which case the model will be pushed in your namespace. Otherwise it should be the whole repository name, for instance `"user_name/model"`, which allows you to push to an organization you are a member of with `"organization_name/model"`. 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: - `"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 passed along to the [`Trainer`]) and a draft of a model card each time there is a model save. The pushes are asynchronous to not block training, and in case the save are very frequent, a new push is only attempted if the previous one is finished. A last push is made with the final model at the end of training. - `"checkpoint"`: like `"every_save"` but the latest checkpoint is also pushed in a subfolder named last-checkpoint, allowing you to resume training easily with `trainer.train(resume_from_checkpoint="last-checkpoint")`. - `"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) 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 `hf auth login`. private_repo (`bool`, *optional*, defaults to `False`): Whether to make the repo private. If `None` (default), the repo will be public unless the organization's default is private. This value is ignored if the repo already exists. always_push (`bool`, *optional*, defaults to `False`): Unless this is `True`, the `Trainer` will skip pushing a checkpoint when the previous push is not finished. revision (`str`, *optional*): The revision to use when pushing to the Hub. Can be a branch name, a tag, or a commit hash. Example: ```py >>> from transformers import TrainingArguments >>> args = TrainingArguments("working_dir") >>> args = args.set_push_to_hub("me/awesome-model") >>> args.hub_model_id 'me/awesome-model' ``` T)rKrMrrOrPrQrRrS)rrr~rrrrs rFset_push_to_hubz!TrainingArguments.set_push_to_hubj sFB $'1 ,*$ rHrbeta1beta2epsilonargsczt||_||_||_||_||_||_||_|S)a A method that regroups all arguments linked to the optimizer and its hyperparameters. Args: name (`str` or [`training_args.OptimizerNames`], *optional*, defaults to `"adamw_torch"`): The optimizer to use: `"adamw_torch"`, `"adamw_torch_fused"`, `"adamw_apex_fused"`, `"adamw_anyprecision"` or `"adafactor"`. learning_rate (`float`, *optional*, defaults to 5e-5): The initial learning rate. weight_decay (`float`, *optional*, defaults to 0): The weight decay to apply (if not zero) to all layers except all bias and LayerNorm weights. beta1 (`float`, *optional*, defaults to 0.9): The beta1 hyperparameter for the adam optimizer or its variants. beta2 (`float`, *optional*, defaults to 0.999): The beta2 hyperparameter for the adam optimizer or its variants. epsilon (`float`, *optional*, defaults to 1e-8): The epsilon hyperparameter for the adam optimizer or its variants. args (`str`, *optional*): Optional arguments that are supplied to AnyPrecisionAdamW (only useful when `optim="adamw_anyprecision"`). Example: ```py >>> from transformers import TrainingArguments >>> args = TrainingArguments("working_dir") >>> args = args.set_optimizer(name="adamw_torch", beta1=0.8) >>> args.optim 'adamw_torch' ``` )r^r:rrrrrr;)rrrrrrrrs rF set_optimizerzTrainingArguments.set_optimizer sCT$D) *(# rHc^t||_||_||_||_||_|S)a A method that regroups all arguments linked to the learning rate scheduler and its hyperparameters. Args: name (`str` or [`SchedulerType`], *optional*, defaults to `"linear"`): The scheduler type to use. See the documentation of [`SchedulerType`] for all possible values. num_epochs(`float`, *optional*, defaults to 3.0): Total number of training epochs to perform (if not an integer, will perform the decimal part percents of 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) until `max_steps` is reached. warmup_ratio (`float`, *optional*, defaults to 0.0): Ratio of total training steps used for a linear warmup from 0 to `learning_rate`. warmup_steps (`int`, *optional*, defaults to 0): Number of steps used for a linear warmup from 0 to `learning_rate`. Overrides any effect of `warmup_ratio`. Example: ```py >>> from transformers import TrainingArguments >>> args = TrainingArguments("working_dir") >>> args = args.set_lr_scheduler(name="cosine", warmup_ratio=0.05) >>> args.warmup_ratio 0.05 ``` )rrrrrr)rrr{rrrs rFset_lr_schedulerz"TrainingArguments.set_lr_scheduler s6L"/t!4 *"(( rHrr drop_last num_workers pin_memorypersistent_workersprefetch_factor sampler_seedc ||_||_||_||_||_||_||_||_| |_| |_ |S)aS A method that regroups all arguments linked to the dataloaders creation. Args: drop_last (`bool`, *optional*, defaults to `False`): Whether to drop the last incomplete batch (if the length of the dataset is not divisible by the batch size) or not. num_workers (`int`, *optional*, defaults to 0): Number of subprocesses to use for data loading (PyTorch only). 0 means that the data will be loaded in the main process. pin_memory (`bool`, *optional*, defaults to `True`): Whether you want to pin memory in data loaders or not. Will default to `True`. persistent_workers (`bool`, *optional*, defaults to `False`): If True, the data loader will not shut down the worker processes after a dataset has been consumed once. This allows to maintain the workers Dataset instances alive. Can potentially speed up training, but will increase RAM usage. Will default to `False`. prefetch_factor (`int`, *optional*): 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. auto_find_batch_size (`bool`, *optional*, defaults to `False`) 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`) ignore_data_skip (`bool`, *optional*, defaults to `False`): When resuming training, whether or not to skip the epochs and batches to get the data loading at the same stage as in the previous training. If set to `True`, the training will begin faster (as that skipping step can take a long time) but will not yield the same results as the interrupted training would have. sampler_seed (`int`, *optional*): Random seed to be used with data samplers. If not set, random generators for data sampling will use the same seed as `self.seed`. This can be used to ensure reproducibility of data sampling, independent of the model seed. Example: ```py >>> from transformers import TrainingArguments >>> args = TrainingArguments("working_dir") >>> args = args.set_dataloader(train_batch_size=16, eval_batch_size=64) >>> args.per_device_train_batch_size 16 ``` ) rrr'r)rGrHr*r`r3r) rrrrrrrrr`r3rs rFset_dataloaderz TrainingArguments.set_dataloader sYp,<(*9'$-!&1#%/"-?**9'$8! 0% rH)r9rS)Twork)rrrr/rr F)rrrNNFF)rFF)rrNF)rrrr.FFFr.)rNNNFN)r_rrrrrN)rrr/rr) rrFrTFNFFN)rrrrrrrrr r__annotations__rrvrrrrr rrrrJrrrrrrrrrrrrrrrrrrrrr rrrNrrrrrrrrrrrrrrrrrr r r r rrrrrrrrrrr#r$r%r&rrr'r(r)r*r+r,r-r.r/r0r1r2r3r4rr5rr6rr7r4rr8 default_optimr pytorch_utilsr9r:r^r;rdr<r>r?rArCrDrErFrGrHrIrJrKrLrMrOrrPrQrRrSrTrrUrVrWrXrYrZr[r^r_r`rarbrdrerfrgrhrirjrkrlrmrnrorprqrrrr__repr__propertyrrrr r r0rRrr&rArDr"rJrLrRrTrV contextlibcontextmanagerr_rdrirmrtryr}rrrrrrrrrrHrFrrsY ~I % V !J  "' ` "$5Fk5lmJm27;<3M5)3./"'^_"$ (-V%_`(',V%ab'/4 @ /hsm.3 B .Xc](-kl(.3kl.Xc]  " J.3 G .Xc]!Ag8hiM5iv?i6jkL%kcV=X4YZJZev?Z6[\J\@^7_`L%` @T7UVM5V#C6Cp:qrermnIs49674u]C/07< t 7tCH~s23 v'abL%a6;]2^_L#_N*..0   Is #j)..0 s#  d"'tvG]>^!_K#_5:896e,c12 %UfFa=bcc  [ M5$)Iq@r#sDs.3@A/M5s*+ [ J', 4   'hsm # v d $ ( t" b  OT 5: n 5+T pqGT J GT ! F NDbF4p+qrD#r$TVEq m 9K%S#X 3459> f 9& 6; { 6tSy!127<ik7!23-2 . -IxdCi()%*v'no%E"ME -/M(-12)E5$ %!&dfFr=s tJ tEV=l4mnItn!noOT$`a.3(ef.IuT3S )*ghGS', 3  'hsm 27 - 2(- - (x}-2 - -8D>#((VW#4+0 | +!4 !&(no!(-)k l()v wK-2XY-HSM#((qr#L(3--2VW-L% S() %TVEq J 9%c49 45 %WX    ~ M4#YZd 6; S  6$sDy/2 $) } $D+0 G +!4}6~ GH   #       3933 B##  --4       / / / /R,--   00d3 /DcN /t /<4 R4S> R $+,',III I  I  I&)II!%IZ26,0!%;--.;; ; %SM ;  ;;;~ &&& &T29%)" /--.//c] /  /f29+1 $"&I--.IId3i( I  I  IIII\-9#'+!"&HH[()H} H tn H  H3-HX,9#"1C'(11 1  1  11sm1j+3 +C&'++ +  +  +^!" #()-%*!&&*BBB B  B  B!B"#B#BBsmBrHrc$eZdZdZdZdZdZdZdZy)r' not_parallelnot_distributed distributedsagemaker_model_parallelsagemaker_data_paralleltpuN) rrrr9r8r(r6r7r5rrHrFr'r'Y s"!L'OK97 CrHr'r)mrrrbrAr dataclassesrrrrr;renumr functoolsr pathlibr typingr r r huggingface_hubr debug_utilsr trainer_utilsrrrrrrutilsrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+ utils.genericr,utils.import_utilsr- get_loggerrrget_log_levels_dictr log_levelsrrNrtorch.distributedrr#accelerate.stater0r1rr2trainer_pt_utilsr3accelerate.parallelism_configr4torch_xla.core.xla_modelcore xla_modelrYrKrLrr!torch_xla.distributed.xla_backend xla_backendxbnrgroupWORLDProcessGroupXlainit_process_groupAssertionError!smdistributed.modelparallel.torch modelparallelr r\rrGrQr\r^rrr'rrHrFrs 88%''.$.%;   H % (W ( ( * / / 1 3J33$?038$?)) e4 zz~~+, & ( KK'  NN@  < ;djj..0C0CD'''6!$**"2"2C4G4GH()rss33 CHHJKK8C=."\."bD& ~-~- ~-B\4rH