pub struct DryRequest {
pub multiplier: f32,
pub base: f32,
pub allowed_length: i32,
pub penalty_last_n: i32,
pub sequence_breakers: Vec<String>,
}Expand description
DRY as a caller SPELLS it: four numbers and a list of strings, with the breakers not yet tokenised.
This is the shape a CLI flag set and an HTTP request body arrive in,
and it exists so that both front ends resolve them the same way.
Self::resolve is the only bridge to DryParams, and it is the
one place that decides what happens when DRY is asked for and there
is no vocabulary to tokenise the breakers against.
Fields§
§multiplier: f32§base: f32§allowed_length: i32§penalty_last_n: i32§sequence_breakers: Vec<String>Implementations§
Source§impl DryRequest
impl DryRequest
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
The same three conditions DryParams::is_enabled reads, asked
before the breakers have been tokenised – so the expensive
vocabulary walk is skipped for the overwhelming majority of
requests, which leave DRY off.
Sourcepub fn resolve(
&self,
vocab: Option<&dyn DryVocab>,
total_context_size: usize,
) -> Result<DryParams, DryVocabMissing>
pub fn resolve( &self, vocab: Option<&dyn DryVocab>, total_context_size: usize, ) -> Result<DryParams, DryVocabMissing>
Tokenise the breakers and build the sampler’s parameters.
vocab is None when the loaded checkpoint has no real
vocabulary. That is fine while DRY is off and a refusal when it
is on; see DryVocabMissing.
An EMPTY breaker list needs no vocabulary either: it is the
caller’s --dry-sequence-breaker none, and there is nothing to
tokenise.
Trait Implementations§
Source§impl Clone for DryRequest
impl Clone for DryRequest
Source§fn clone(&self) -> DryRequest
fn clone(&self) -> DryRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DryRequest
impl Debug for DryRequest
Source§impl Default for DryRequest
impl Default for DryRequest
Source§impl PartialEq for DryRequest
impl PartialEq for DryRequest
impl StructuralPartialEq for DryRequest
Auto Trait Implementations§
impl Freeze for DryRequest
impl RefUnwindSafe for DryRequest
impl Send for DryRequest
impl Sync for DryRequest
impl Unpin for DryRequest
impl UnsafeUnpin for DryRequest
impl UnwindSafe for DryRequest
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> 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