Skip to main content

LlamaError

Enum LlamaError 

Source
pub enum LlamaError {
Show 15 variants BackendAlreadyInitialized, ModelLoad(String), ContextCreation, Nul(NulError), InvalidPath, Tokenize, TokenToPiece, TokenOutOfRange { token: i32, n_vocab: i32, }, Decode(i32), BatchOverflow { capacity: usize, index: usize, }, TooManySeqIds { got: usize, max: usize, }, NoLogits(i32), MtpInit, MtpBegin(i32), MtpStep(i32),
}
Expand description

Errors returned by the safe wrapper.

Variants§

§

BackendAlreadyInitialized

The global backend was already initialized (it is a process-wide singleton).

§

ModelLoad(String)

llama_model_load_from_file returned null for the given path.

§

ContextCreation

llama_init_from_model returned null.

§

Nul(NulError)

A path or prompt contained an interior NUL byte.

§

InvalidPath

The model path was not valid UTF-8 / could not be converted to a C string.

§

Tokenize

Tokenization failed (negative count from llama_tokenize).

§

TokenToPiece

Detokenization produced invalid UTF-8 that could not be recovered.

§

TokenOutOfRange

A token id was outside the model’s vocabulary range [0, n_vocab). Handing it to ik’s tokenizer would abort the process (it does an out-of-range std::vector::at), so it is rejected up front.

Fields

§token: i32

The offending token id.

§n_vocab: i32

The model’s vocabulary size.

§

Decode(i32)

llama_decode returned a non-zero status.

§

BatchOverflow

A batch operation exceeded the batch’s allocated capacity.

Fields

§capacity: usize

Allocated token capacity of the batch.

§index: usize

Index that overflowed.

§

TooManySeqIds

More sequence ids were supplied for a token than the batch’s n_seq_max.

Fields

§got: usize

Number of seq_ids supplied.

§max: usize

Batch’s configured n_seq_max.

§

NoLogits(i32)

Requested logits for a position that was not computed / out of range.

§

MtpInit

MTP speculative driver initialization failed (e.g. 0 NextN layers, or an openPangu/recurrent target, or a context not created with .with_mtp(true)).

§

MtpBegin(i32)

MTP begin (prompt warmup) failed.

§

MtpStep(i32)

MTP step (draft/verify/accept/commit) failed.

Trait Implementations§

Source§

impl Debug for LlamaError

Source§

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

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

impl Display for LlamaError

Source§

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

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

impl Error for LlamaError

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 From<NulError> for LlamaError

Source§

fn from(source: NulError) -> Self

Converts to this type from the input type.

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> 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> 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.
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