Skip to main content

SampleOpts

Struct SampleOpts 

Source
pub struct SampleOpts {
Show 26 fields pub temperature: f32, pub top_k: usize, pub top_p: f32, pub seed: u64, pub greedy: bool, pub dynamic_temp: Option<(f32, f32)>, pub dynamic_temp_exponent: f32, pub typical_p: f32, pub top_n_sigma: f32, pub xtc_threshold: f32, pub xtc_prob: f32, pub dry_multiplier: f32, pub dry_base: f32, pub dry_allowed_length: usize, pub dry_max_ngram: usize, pub dry_sequence_breakers: [u32; 32], pub dry_sequence_breakers_len: u8, pub mirostat: MirostatMode, pub mirostat_tau: f32, pub mirostat_eta: f32, pub mirostat_m: usize, pub repetition_penalty: f32, pub frequency_penalty: f32, pub presence_penalty: f32, pub repetition_window: usize, pub min_keep: usize,
}

Fields§

§temperature: f32§top_k: usize§top_p: f32§seed: u64§greedy: bool§dynamic_temp: Option<(f32, f32)>§dynamic_temp_exponent: f32§typical_p: f32§top_n_sigma: f32§xtc_threshold: f32§xtc_prob: f32§dry_multiplier: f32§dry_base: f32§dry_allowed_length: usize§dry_max_ngram: usize§dry_sequence_breakers: [u32; 32]

DRY sequence-break tokens packed into a fixed-size array. Use [SampleOpts::dry_breakers] to read the slice or [SampleOpts::with_dry_breakers] to set it.

§dry_sequence_breakers_len: u8§mirostat: MirostatMode§mirostat_tau: f32§mirostat_eta: f32§mirostat_m: usize§repetition_penalty: f32§frequency_penalty: f32§presence_penalty: f32§repetition_window: usize§min_keep: usize

Implementations§

Source§

impl SampleOpts

Source

pub fn greedy() -> SampleOpts

Source

pub fn temperature(temp: f32, seed: u64) -> SampleOpts

Source

pub fn with_top_k(self, k: usize) -> SampleOpts

Source

pub fn with_top_p(self, p: f32) -> SampleOpts

Source

pub fn with_dynamic_temp(self, min: f32, max: f32) -> SampleOpts

Source

pub fn with_typical_p(self, p: f32) -> SampleOpts

Source

pub fn with_top_n_sigma(self, n: f32) -> SampleOpts

Source

pub fn with_xtc(self, threshold: f32, prob: f32) -> SampleOpts

Source

pub fn with_dry( self, multiplier: f32, base: f32, allowed_length: usize, ) -> SampleOpts

Source

pub fn with_mirostat_v1(self, tau: f32, eta: f32) -> SampleOpts

Source

pub fn with_mirostat_v2(self, tau: f32, eta: f32) -> SampleOpts

Source

pub fn with_repetition_penalty(self, p: f32) -> SampleOpts

Source

pub fn with_frequency_presence( self, frequency: f32, presence: f32, ) -> SampleOpts

Source

pub fn is_classic(&self) -> bool

True when only classic top-k/top-p/temperature/greedy is active — callers can stay on the cheap inline path. Returns false the moment any advanced sampler is engaged so they get routed through SamplerChain.

Source

pub fn into_chain(&self) -> SamplerChain

Build a rlx_runtime::SamplerChain from these options. See rlx_runtime::SampleOpts::into_chain — same ordering.

Trait Implementations§

Source§

impl Clone for SampleOpts

Source§

fn clone(&self) -> SampleOpts

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SampleOpts

Source§

impl Debug for SampleOpts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more