temp / project /training_optimizations.py
PriyaMishra's picture
Copy model from AjayRangoji/temp
f5d6a7c verified
Raw History Blame Contribute Delete
448 Bytes
"""Reduce training padding while retaining sequential validation batches."""
from torch.utils.data import SequentialSampler
from trl import SFTTrainer
class OptimizedSFTTrainer(SFTTrainer):
def _get_eval_sampler(self, eval_dataset):
# Training length grouping should not change validation's batch ordering.
# Accelerate shards this sequential loader and gathers the full split.
return SequentialSampler(eval_dataset)