Why Padding Is the Usual Way and Packing the Alternative
What a Hugging Face post says padding input sequences in mini-batches is and what packing examples without padding is.
For: Learners who know what a training batch is.
What padding is
Padding input sequences in mini-batches is a usual method to collate inputs during training.[1]
What packing is
Packing examples without padding, and using the token position information, is a more efficient alternative.[1]
Sources
- Packing with Flash Attention 2 (huggingface.co · checked )
More articles
- LearningWhy Long Sequences Are Hard to Train OnWhat a Hugging Face post says about why long-sequence training has become essential, which tasks need it and how attention scales.
- LearningWhy Optimizer State Dominates Training MemoryWhat a Hugging Face post says about why the optimizer state takes a significant share of training memory and what GaLore does about it.
- LearningWhat Visual-Language Models Combine and Which Tasks They TackleWhat a Hugging Face guide says visual-language models face as a challenge, which image-to-text tasks they tackle and what captioning can do.