pub struct SamplingParams {
pub temperature: f32,
pub top_p: f32,
pub top_k: usize,
pub repetition_penalty: f32,
pub presence_penalty: f32,
pub frequency_penalty: f32,
}Expand description
Sampling parameters for one generation request. temperature <= 0.0
means “sample nothing, take the greedy argmax” – the same
deterministic behavior ferrox always had before this module existed.
Fields§
§temperature: f32§top_p: f32Nucleus sampling threshold in (0.0, 1.0]. 1.0 disables top-p filtering (every token with nonzero probability is eligible).
top_k: usizeKeep only the top_k highest-probability tokens before
sampling. 0 disables top-k filtering.
repetition_penalty: f321.0 discourages repeating a token already in
history; 1.0 disables repetition penalty. Uses the standard convention (divide positive logits, multiply negative ones) so the penalty always pushes toward less likely, regardless of logit sign.
presence_penalty: f32OpenAI-style presence penalty: subtract from logits of tokens
that already appeared in history (once per distinct token).
frequency_penalty: f32OpenAI-style frequency penalty: subtract frequency_penalty * count from logits for each token id seen in history.
Trait Implementations§
Source§impl Clone for SamplingParams
impl Clone for SamplingParams
Source§fn clone(&self) -> SamplingParams
fn clone(&self) -> SamplingParams
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 SamplingParams
impl Debug for SamplingParams
Auto Trait Implementations§
impl Freeze for SamplingParams
impl RefUnwindSafe for SamplingParams
impl Send for SamplingParams
impl Sync for SamplingParams
impl Unpin for SamplingParams
impl UnsafeUnpin for SamplingParams
impl UnwindSafe for SamplingParams
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