Skip to main content

LmError

Enum LmError 

Source
pub enum LmError {
Show 17 variants DimensionMismatch { expected: usize, got: usize, }, InvalidConfig { msg: String, }, EmptyInput { context: &'static str, }, OutOfVocab { token: u32, }, TokenizerUninitialized, Utf8Decode { token: u32, }, WeightNotFound { name: String, }, WeightShapeMismatch { name: String, expected: Vec<usize>, got: Vec<usize>, }, LayerIndexOutOfRange { idx: usize, n_layers: usize, }, HeadDimMismatch { hidden_dim: usize, n_heads: usize, }, KvCacheLengthMismatch { past_len: usize, got: usize, }, SequenceTooLong { total_len: usize, max_pos: usize, }, InvalidMergePair { a: u32, b: u32, }, VocabSizeMismatch { expected: usize, got: usize, }, GqaHeadMismatch { n_heads: usize, n_kv_heads: usize, }, WeightDataLengthMismatch { data_len: usize, shape: Vec<usize>, expected: usize, }, Internal { msg: String, },
}
Expand description

All errors that can arise from LLM inference operations.

Variants§

§

DimensionMismatch

Tensor or slice dimension does not match expectation.

Fields

§expected: usize
§got: usize
§

InvalidConfig

Model or layer configuration is invalid.

Fields

§

EmptyInput

An input that must be non-empty was empty.

Fields

§context: &'static str
§

OutOfVocab

A token id is outside the vocabulary range.

Fields

§token: u32
§

TokenizerUninitialized

Tokenizer was used before being properly initialised.

§

Utf8Decode

Token byte sequence is not valid UTF-8.

Fields

§token: u32
§

WeightNotFound

A named weight entry is absent from ModelWeights.

Fields

§name: String
§

WeightShapeMismatch

A named weight has an unexpected shape.

Fields

§name: String
§expected: Vec<usize>
§got: Vec<usize>
§

LayerIndexOutOfRange

Transformer layer index is out of range.

Fields

§idx: usize
§n_layers: usize
§

HeadDimMismatch

Hidden dimension is not divisible by the number of attention heads.

Fields

§hidden_dim: usize
§n_heads: usize
§

KvCacheLengthMismatch

KV cache contains a different number of past tokens than expected.

Fields

§past_len: usize
§got: usize
§

SequenceTooLong

Input sequence length exceeds the model’s max_position_embeddings.

Fields

§total_len: usize
§max_pos: usize
§

InvalidMergePair

A BPE merge references tokens that are not in the vocabulary.

Fields

§

VocabSizeMismatch

Vocabulary size does not match model configuration.

Fields

§expected: usize
§got: usize
§

GqaHeadMismatch

n_kv_heads does not divide n_heads evenly (GQA requirement).

Fields

§n_heads: usize
§n_kv_heads: usize
§

WeightDataLengthMismatch

A weight tensor element count does not match its declared shape.

Fields

§data_len: usize
§shape: Vec<usize>
§expected: usize
§

Internal

Catch-all for internal invariant violations.

Fields

Trait Implementations§

Source§

impl Clone for LmError

Source§

fn clone(&self) -> LmError

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 Debug for LmError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for LmError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for LmError

Source§

impl Error for LmError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for LmError

Source§

fn eq(&self, other: &LmError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for LmError

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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.