100 lines
2.5 KiB
Rust
100 lines
2.5 KiB
Rust
use thiserror::Error;
|
|
|
|
#[derive(Error, Debug)]
|
|
pub enum CompressionError {
|
|
#[error("Tensor error: {0}")]
|
|
Tensor(#[from] rtx_tensor::TensorError),
|
|
|
|
#[error("Runtime error: {0}")]
|
|
Runtime(#[from] rtx_runtime::RuntimeError),
|
|
|
|
#[error("Inference error: {0}")]
|
|
Inference(#[from] rtx_inference::InferenceError),
|
|
|
|
#[error("IO error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
|
|
#[error("Serialization error: {0}")]
|
|
Serialization(String),
|
|
|
|
#[error("Invalid configuration: {0}")]
|
|
InvalidConfig(String),
|
|
|
|
#[error("Compression failed: {0}")]
|
|
CompressionFailed(String),
|
|
|
|
#[error("Decompression failed: {0}")]
|
|
DecompressionFailed(String),
|
|
|
|
#[error("Quantization error: {0}")]
|
|
Quantization(#[from] QuantizationError),
|
|
|
|
#[error("KV cache error: {0}")]
|
|
KVCacheError(String),
|
|
|
|
#[error("Checkpoint error: {0}")]
|
|
CheckpointError(String),
|
|
|
|
#[error("Mixed precision optimization error: {0}")]
|
|
MixedPrecisionError(String),
|
|
|
|
#[error("Arrow integration error: {0}")]
|
|
ArrowError(String),
|
|
|
|
#[error("Hardware constraint violation: {0}")]
|
|
HardwareConstraint(String),
|
|
|
|
#[error("Memory limit exceeded: requested {requested} MB, limit {limit} MB")]
|
|
MemoryLimitExceeded { requested: usize, limit: usize },
|
|
|
|
#[error("Unsupported operation: {0}")]
|
|
UnsupportedOperation(String),
|
|
}
|
|
|
|
#[derive(Error, Debug)]
|
|
pub enum QuantizationError {
|
|
#[error("Quantizer not calibrated - call calibrate() first")]
|
|
NotCalibrated,
|
|
|
|
#[error("Insufficient calibration data provided")]
|
|
InsufficientCalibrationData,
|
|
|
|
#[error("Per-channel statistics not available")]
|
|
PerChannelStatsNotAvailable,
|
|
|
|
#[error("Channel dimension mismatch")]
|
|
ChannelMismatch,
|
|
|
|
#[error("Mixed precision requires layer name")]
|
|
MixedPrecisionRequiresLayerName,
|
|
|
|
#[error("Mixed precision not configured")]
|
|
MixedPrecisionNotConfigured,
|
|
|
|
#[error("Layer not found: {0}")]
|
|
LayerNotFound(String),
|
|
|
|
#[error("Serialization failed: {0}")]
|
|
SerializationFailed(String),
|
|
|
|
#[error("Deserialization failed: {0}")]
|
|
DeserializationFailed(String),
|
|
|
|
#[error("Invalid quantization scheme")]
|
|
InvalidScheme,
|
|
|
|
#[error("Invalid calibration configuration: {0}")]
|
|
InvalidCalibrationConfig(String),
|
|
|
|
#[error("Invalid configuration: {0}")]
|
|
InvalidConfig(String),
|
|
|
|
#[error("Tensor error: {0}")]
|
|
TensorError(String),
|
|
|
|
#[error("GPU error: {0}")]
|
|
GpuError(String),
|
|
}
|
|
|
|
pub type Result<T> = std::result::Result<T, CompressionError>;
|