pub struct SamplingParams {
pub temperature: f32,
pub top_k: Option<usize>,
pub top_p: Option<f32>,
pub min_p: Option<f32>,
pub presence_penalty: f32,
pub frequency_penalty: f32,
pub repetition_penalty: f32,
pub seed: u64,
pub logprobs: Option<usize>,
}Expand description
Every control for one sampling step. Default is greedy with no penalties and no logprobs.
Fields§
§temperature: f32Softmax temperature; <= 0 or NaN means greedy.
top_k: Option<usize>Keep only the k most probable tokens (k >= 1).
top_p: Option<f32>Nucleus mass in (0, 1].
min_p: Option<f32>Minimum probability relative to the most probable token, in [0, 1].
presence_penalty: f32Subtracted once from a token’s logit if it appears in the history.
frequency_penalty: f32Subtracted per occurrence of a token in the history.
repetition_penalty: f32Multiplicative penalty on seen tokens (> 0; 1.0 is off).
seed: u64Seeds the caller’s RNG state for a new sequence.
logprobs: Option<usize>Report this many top logprobs (plus the chosen token’s); None reports none.
Implementations§
Trait Implementations§
Source§impl Clone for SamplingParams
impl Clone for SamplingParams
Source§impl Debug for SamplingParams
impl Debug for SamplingParams
Source§impl Default for SamplingParams
impl Default for SamplingParams
Source§impl PartialEq for SamplingParams
impl PartialEq for SamplingParams
impl StructuralPartialEq 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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
Converts
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> ⓘ
Converts
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