pub struct TextRecipe {
pub name: Cow<'static, str>,
pub selector: Selector,
pub weight: f32,
pub instruction: Option<Cow<'static, str>>,
}Expand description
Defines how to build a text sample from a record.
Fields§
§name: Cow<'static, str>Unique name for this recipe.
selector: SelectorSelector used for text chunks.
weight: f32Relative weight controlling how often this recipe is selected versus other recipes.
Each recipe with a positive weight receives a number of slots in the shuffled selection
order proportional to weight / min_positive_weight across all active recipes, so a
recipe with weight = 2.0 is drawn approximately twice as often as one with weight = 1.0. The weight also scales the weight field on every crate::TextSample
returned by this recipe, which the caller’s training loop can use for loss weighting.
Recipes with weight <= 0.0 are excluded from selection entirely and no samples
are produced for them.
instruction: Option<Cow<'static, str>>Optional instruction text attached to samples from this recipe.
Trait Implementations§
Source§impl Clone for TextRecipe
impl Clone for TextRecipe
Source§fn clone(&self) -> TextRecipe
fn clone(&self) -> TextRecipe
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TextRecipe
impl RefUnwindSafe for TextRecipe
impl Send for TextRecipe
impl Sync for TextRecipe
impl Unpin for TextRecipe
impl UnsafeUnpin for TextRecipe
impl UnwindSafe for TextRecipe
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more