Buckets:
Fine-tuning
Fine-tuning continues training a large pretrained model on a smaller dataset specific to a task or domain. For example, fine-tuning on a dataset of coding examples helps the model get better at coding. Fine-tuning is identical to pretraining except you don't start with random weights. It also requires far less compute, data, and time.
The tutorial below walks through fine-tuning a large language model with Trainer.
[!AgentPrompt] Help the user plan a fine-tuning run for their task. Before proposing a configuration, identify the task, pretrained model and revision, dataset fields, evaluation data, Transformers version, hardware, and available memory. Use this tutorial to check the data preparation, model loading, and
Trainersetup that apply to their case. Do not assume the example dataset or model fits a different task.
- Ask for missing details that could change the model, preprocessing, or training setup. State any assumptions.
- Keep evaluation examples separate from training data. Select a model and tokenizer for the task, prepare the model's expected inputs and labels, and choose a data collator that matches those inputs.
- Set
TrainingArgumentsto fit the user's hardware and goals. Configure evaluation and checkpoint saving when the user needs them. Run a small test before a full training job, and check that the model receives the expected inputs, the loss is finite, and evaluation completes.- Do not start a full training run or upload artifacts unless the user asks. Report the proposed configuration, evidence from any test, expected resource tradeoffs, and anything you could not verify.
Log in to your Hugging Face account with your user token to push your fine-tuned model to the Hub.
from huggingface_hub import login
login()
Tokenization
Load a dataset and tokenize the text column the model trains on (horoscope in the dataset below).
Xet Storage Details
- Size:
- 8.48 kB
- Xet hash:
- 98dd81feb9c98a6522b89fc3174d09f64c23da092a77564d553c1336f10a2c0d
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.