trinity.buffer.selector package#
Submodules#
- trinity.buffer.selector.difficulty_estimator module
BaseBetaPREstimatorBaseBetaPREstimator.__init__()BaseBetaPREstimator.nBaseBetaPREstimator.mBaseBetaPREstimator.lambBaseBetaPREstimator.rhoBaseBetaPREstimator.alphasBaseBetaPREstimator.betasBaseBetaPREstimator.set()BaseBetaPREstimator.update()BaseBetaPREstimator.predict_pr()BaseBetaPREstimator.equivalent_count()
InterpolationBetaPREstimator
- trinity.buffer.selector.selector module
Module contents#
- class trinity.buffer.selector.BaseSelector(data_source: _HFBatchReader, config: TaskSelectorConfig)[source]#
Bases:
objectAbstract base class defining the interface for custom data selection strategies.
A selector determines which samples (by index) are selected from the dataset during training. It enables flexible sampling beyond simple sequential or random access, supporting active learning, curriculum learning, or difficulty-based sampling in the future.
- Subclasses must implement:
get_indices: returns list of indices for next batch
update: updates internal state using feedback (e.g., loss values, mean rewards, etc.)
state_dict / load_state_dict: for saving/loading selector state (checkpointing)
- __init__(data_source: _HFBatchReader, config: TaskSelectorConfig)[source]#
- get_indices(batch_size: int, return_extra_info: bool = False) List[int][source]#
Select a batch of sample indices from the dataset.
- Parameters:
batch_size (int) β Number of indices to return
return_extra_info (bool) β If True, may return additional metadata (future use)
- Returns:
Selected indices into the dataset
- Return type:
List[int]
- update(indices: List[int], values: List[float]) None[source]#
Update internal state based on feedback (e.g., model loss, accuracy).
This allows adaptive selectors (like hard example mining) to learn over time.
- Parameters:
indices (List[int]) β Previously selected indices
values (List[float]) β Feedback values corresponding to those indices