feat: add record-mode to Store for DPO/GRPO
- Store gains fetch_record/num_records alongside stream fetch/__len__ - save_bin/load_bin support per-record offsets via record_keys param - H5Store/MmapStore/JsonlStore all support dual stream+record access - DPODataset/GRPODataset use fetch_record, no cross-record concat - dpo_collate_fn + collate_fn wired through TrainConfig - fixes attention context leakage in DPO from windowed concatenation
This commit is contained in:
@@ -5,7 +5,15 @@ import torch.distributed as dist
|
||||
from torch.utils.data import Dataset, Sampler
|
||||
|
||||
|
||||
class ResumableDistributedSampler(Sampler[int]):
|
||||
class RDSampler(Sampler[int]):
|
||||
"""Resumable Distributed Sampler.
|
||||
|
||||
A distributed sampler that supports checkpoint-based resume: iteration
|
||||
state (epoch, position) is tracked so training can continue from the
|
||||
exact sample after a restart. Shards the dataset across
|
||||
``dist.world_size`` replicas with optional shuffling.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
data_source: Dataset,
|
||||
|
||||
Reference in New Issue
Block a user