pub trait Sampler {
// Required methods
fn next_pair_batch_with_weights(
&self,
split: SplitLabel,
weights: &HashMap<SourceId, f32>,
) -> Result<SampleBatch, SamplerError>;
fn next_text_batch_with_weights(
&self,
split: SplitLabel,
weights: &HashMap<SourceId, f32>,
) -> Result<TextBatch, SamplerError>;
fn next_triplet_batch_with_weights(
&self,
split: SplitLabel,
weights: &HashMap<SourceId, f32>,
) -> Result<TripletBatch, SamplerError>;
// Provided methods
fn next_pair_batch(
&self,
split: SplitLabel,
) -> Result<SampleBatch, SamplerError> { ... }
fn next_text_batch(
&self,
split: SplitLabel,
) -> Result<TextBatch, SamplerError> { ... }
fn next_triplet_batch(
&self,
split: SplitLabel,
) -> Result<TripletBatch, SamplerError> { ... }
}Expand description
Public sampling interface for pair, triplet, and text batch generation.
Required Methods§
Sourcefn next_pair_batch_with_weights(
&self,
split: SplitLabel,
weights: &HashMap<SourceId, f32>,
) -> Result<SampleBatch, SamplerError>
fn next_pair_batch_with_weights( &self, split: SplitLabel, weights: &HashMap<SourceId, f32>, ) -> Result<SampleBatch, SamplerError>
Returns a batch of pairs with per-call source weights.
Sourcefn next_text_batch_with_weights(
&self,
split: SplitLabel,
weights: &HashMap<SourceId, f32>,
) -> Result<TextBatch, SamplerError>
fn next_text_batch_with_weights( &self, split: SplitLabel, weights: &HashMap<SourceId, f32>, ) -> Result<TextBatch, SamplerError>
Returns a batch of text samples with per-call source weights.
Sourcefn next_triplet_batch_with_weights(
&self,
split: SplitLabel,
weights: &HashMap<SourceId, f32>,
) -> Result<TripletBatch, SamplerError>
fn next_triplet_batch_with_weights( &self, split: SplitLabel, weights: &HashMap<SourceId, f32>, ) -> Result<TripletBatch, SamplerError>
Returns a batch of triplets with per-call source weights.
Provided Methods§
Sourcefn next_pair_batch(
&self,
split: SplitLabel,
) -> Result<SampleBatch, SamplerError>
fn next_pair_batch( &self, split: SplitLabel, ) -> Result<SampleBatch, SamplerError>
Returns a batch of pairs. Consumes the shared epoch cursor for anchor selection.
Sourcefn next_text_batch(&self, split: SplitLabel) -> Result<TextBatch, SamplerError>
fn next_text_batch(&self, split: SplitLabel) -> Result<TextBatch, SamplerError>
Returns a batch of text samples. Consumes the shared epoch cursor for anchor selection.
Sourcefn next_triplet_batch(
&self,
split: SplitLabel,
) -> Result<TripletBatch, SamplerError>
fn next_triplet_batch( &self, split: SplitLabel, ) -> Result<TripletBatch, SamplerError>
Returns a batch of triplets. Consumes the shared epoch cursor for anchor selection.