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.
InvalidConfig
Model or layer configuration is invalid.
EmptyInput
An input that must be non-empty was empty.
OutOfVocab
A token id is outside the vocabulary range.
TokenizerUninitialized
Tokenizer was used before being properly initialised.
Utf8Decode
Token byte sequence is not valid UTF-8.
WeightNotFound
A named weight entry is absent from ModelWeights.
WeightShapeMismatch
A named weight has an unexpected shape.
LayerIndexOutOfRange
Transformer layer index is out of range.
HeadDimMismatch
Hidden dimension is not divisible by the number of attention heads.
KvCacheLengthMismatch
KV cache contains a different number of past tokens than expected.
SequenceTooLong
Input sequence length exceeds the model’s max_position_embeddings.
InvalidMergePair
A BPE merge references tokens that are not in the vocabulary.
VocabSizeMismatch
Vocabulary size does not match model configuration.
GqaHeadMismatch
n_kv_heads does not divide n_heads evenly (GQA requirement).
WeightDataLengthMismatch
A weight tensor element count does not match its declared shape.
Internal
Catch-all for internal invariant violations.
Trait Implementations§
impl Eq for LmError
Source§impl Error for LmError
impl Error for LmError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()