pub struct SamplerOrder { /* private fields */ }Expand description
A validated sampler chain: the steps ferrox will run, in the order it will run them.
Fixed-capacity and Copy because crate::sampling::SamplingParams
is cloned per request and read per token; a Vec here would be an
allocation on that path for at most
SamplerName::ALL.len() entries.
Implementations§
Source§impl SamplerOrder
impl SamplerOrder
Sourcepub fn has_penalties(&self) -> bool
pub fn has_penalties(&self) -> bool
Whether the penalties are part of this chain. false means the
caller left penalties out, which llama.cpp reads as “do not
penalise”, so ferrox must not penalise either.
Sourcepub fn implemented_names() -> Vec<&'static str>
pub fn implemented_names() -> Vec<&'static str>
The canonical spellings of every sampler this engine implements, derived from the one table rather than restated.
Sourcepub fn from_names<I, S>(names: I) -> Result<Self, SamplerOrderError>
pub fn from_names<I, S>(names: I) -> Result<Self, SamplerOrderError>
Parse a chain from already-split names.
Each name is trimmed and lowercased first: a spelling is not a
semantic, so Top_K cannot mean anything but top_k and
refusing it would be a false refusal.
Four things are refused, all BY NAME:
- a name llama.cpp does not define either;
- a real llama.cpp sampler ferrox does not implement;
- the same sampler twice, which llama.cpp tolerates and which here would silently mean “run it once” for the idempotent filters and “square it” for temperature;
penaltiesanywhere but first – seeSamplerOrderError::PenaltiesNotFirst;- a chain with no
temperature– seeSamplerOrderError::TemperatureMissing.
Trait Implementations§
Source§impl Clone for SamplerOrder
impl Clone for SamplerOrder
Source§fn clone(&self) -> SamplerOrder
fn clone(&self) -> SamplerOrder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SamplerOrder
Source§impl Debug for SamplerOrder
impl Debug for SamplerOrder
Source§impl Default for SamplerOrder
impl Default for SamplerOrder
Source§impl Display for SamplerOrder
Round-trips through FromStr, so the CLI can print the default it
applied and have that string mean the same chain.
impl Display for SamplerOrder
Round-trips through FromStr, so the CLI can print the default it
applied and have that string mean the same chain.
impl Eq for SamplerOrder
Source§impl FromStr for SamplerOrder
;-separated, exactly as llama.cpp’s --samplers takes it.
impl FromStr for SamplerOrder
;-separated, exactly as llama.cpp’s --samplers takes it.
Source§impl Hash for SamplerOrder
impl Hash for SamplerOrder
Source§impl PartialEq for SamplerOrder
Equality and hashing are over the LIVE steps only. The backing array
is fixed-capacity, so the slots past len hold filler that two equal
chains need not agree about – and the response cache keys on this,
where a spurious inequality would just miss and a spurious equality
would serve one caller’s answer to another.
impl PartialEq for SamplerOrder
Equality and hashing are over the LIVE steps only. The backing array
is fixed-capacity, so the slots past len hold filler that two equal
chains need not agree about – and the response cache keys on this,
where a spurious inequality would just miss and a spurious equality
would serve one caller’s answer to another.
Auto Trait Implementations§
impl Freeze for SamplerOrder
impl RefUnwindSafe for SamplerOrder
impl Send for SamplerOrder
impl Sync for SamplerOrder
impl Unpin for SamplerOrder
impl UnsafeUnpin for SamplerOrder
impl UnwindSafe for SamplerOrder
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