1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, QLoraError>;
7
8#[derive(Error, Debug)]
10#[non_exhaustive]
11pub enum QLoraError {
12 #[error("invalid quantization config: {0}")]
14 InvalidConfig(String),
15
16 #[error("quantization error: {0}")]
18 Quantization(String),
19
20 #[error("shape mismatch: expected {expected:?}, got {actual:?}")]
22 ShapeMismatch {
23 expected: Vec<usize>,
25 actual: Vec<usize>,
27 },
28
29 #[error("GGUF export error: {0}")]
31 GgufExport(String),
32
33 #[error("native format export error: {0}")]
35 NativeExport(String),
36
37 #[error("IO error: {0}")]
39 Io(#[from] std::io::Error),
40
41 #[error("PEFT error: {0}")]
43 Peft(#[from] peft_rs::PeftError),
44
45 #[error("candle error: {0}")]
47 Candle(#[from] candle_core::Error),
48}