pub enum TokenizerError {
Show 15 variants
InvalidConfig(String),
DimensionMismatch {
expected: usize,
got: usize,
context: String,
},
EncodingError {
operation: String,
reason: String,
},
DecodingError {
operation: String,
reason: String,
},
CodebookNotInitialized {
hint: String,
},
ValueOutOfRange {
value: f32,
min: f32,
max: f32,
context: String,
},
CoreError(CoreError),
InternalError(String),
InvalidInput {
operation: String,
reason: String,
},
SerializationError(String),
IoError(Error),
TrainingError {
epoch: usize,
reason: String,
},
NumericalError {
operation: String,
reason: String,
},
ResourceLimitExceeded {
resource: String,
details: String,
},
NotImplemented(String),
}Expand description
Errors that can occur in tokenizer operations
Variants§
InvalidConfig(String)
Configuration parameter is invalid
This error includes detailed context about what parameter was invalid and why, to help users fix their configuration.
DimensionMismatch
Array dimensions don’t match expected values
Provides both the expected and actual dimensions to help diagnose shape mismatches in multi-dimensional arrays.
EncodingError
Signal encoding operation failed
Wraps detailed information about why encoding failed, such as invalid input ranges, NaN values, or algorithmic failures.
DecodingError
Signal decoding operation failed
Includes context about which decoding step failed and why.
CodebookNotInitialized
Codebook has not been initialized before use
This typically happens when trying to use a VQ-VAE tokenizer before training or loading a pretrained codebook.
ValueOutOfRange
Value is outside the valid range
Provides the offending value and the valid range for debugging.
CoreError(CoreError)
Error from kizzasi-core crate
InternalError(String)
Internal error that should not happen under normal circumstances
If you encounter this error, it likely indicates a bug in the library. Please report it with the full error message and context.
InvalidInput
Invalid input data provided to a function
This error provides context about what was invalid in the input, such as empty arrays, NaN values, or incorrect types.
SerializationError(String)
Serialization or deserialization failed
IoError(Error)
File I/O operation failed
TrainingError
Training operation failed
NumericalError
Numerical computation resulted in invalid values (NaN, Inf)
ResourceLimitExceeded
Resource limit exceeded
NotImplemented(String)
Feature not yet implemented
Implementations§
Source§impl TokenizerError
impl TokenizerError
Sourcepub fn dim_mismatch(
expected: usize,
got: usize,
context: impl Into<String>,
) -> Self
pub fn dim_mismatch( expected: usize, got: usize, context: impl Into<String>, ) -> Self
Create a dimension mismatch error with context
Sourcepub fn encoding(operation: impl Into<String>, reason: impl Into<String>) -> Self
pub fn encoding(operation: impl Into<String>, reason: impl Into<String>) -> Self
Create an encoding error with context
Sourcepub fn decoding(operation: impl Into<String>, reason: impl Into<String>) -> Self
pub fn decoding(operation: impl Into<String>, reason: impl Into<String>) -> Self
Create a decoding error with context
Sourcepub fn out_of_range(
value: f32,
min: f32,
max: f32,
context: impl Into<String>,
) -> Self
pub fn out_of_range( value: f32, min: f32, max: f32, context: impl Into<String>, ) -> Self
Create a value out of range error with context
Sourcepub fn invalid_input(
operation: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn invalid_input( operation: impl Into<String>, reason: impl Into<String>, ) -> Self
Create an invalid input error with context
Trait Implementations§
Source§impl Debug for TokenizerError
impl Debug for TokenizerError
Source§impl Display for TokenizerError
impl Display for TokenizerError
Source§impl Error for TokenizerError
impl Error for TokenizerError
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
Source§impl From<CoreError> for TokenizerError
impl From<CoreError> for TokenizerError
Auto Trait Implementations§
impl Freeze for TokenizerError
impl !RefUnwindSafe for TokenizerError
impl Send for TokenizerError
impl Sync for TokenizerError
impl Unpin for TokenizerError
impl !UnwindSafe for TokenizerError
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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