flâneur

Trainer

huggingface.co · 131 words · saved by 1 readers

Trainer is a complete training and evaluation loop for Transformers’ PyTorch models. Plug a model, preprocessor, dataset, and training arguments into Trainer and let it handle the rest to start training faster. Trainer is also powered by Accelerate, a library for handling large models for distributed training. This guide will show you how Trainer works and how to customize it for your use case with a callback. Trainer contains all the necessary components of a training loop. Manually coding this training loop everytime can be inconvenient or a barrier if you’re just getting started with machine learning. Trainer abstracts this process, allowing you to focus on the model, dataset, and training design choices. Configure your training with hyperparameters and options from TrainingArguments which supports many features such as distributed training, torch.compile, mixed precision training, and saving the model to the Hub. The number of available parameters available in TrainingArguments may

Trainer is a complete training and evaluation loop for Transformers models. You only need a model and dataset to get started. Underneath, Trainer handles batching, shuffling, and padding your dataset into tensors. The training loop runs the forward pass, calculates loss, backpropagates gradients, and updates weights. Configure the training run with TrainingArguments to customize everything from batch size and training duration to distributed strategies, compilation, and more. Next steps Start with the fine-tuning tutorial for an introduction to training a large language model with…

related reading