littlebit_models/
error.rs1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, ModelError>;
7
8#[derive(Debug, Error)]
11pub enum ModelError {
12 #[error(transparent)]
14 Core(#[from] littlebit_core::LittleBitError),
15
16 #[error("tensor operation failed: {0}")]
18 Candle(#[from] candle_core::Error),
19
20 #[error("i/o error: {0}")]
22 Io(#[from] std::io::Error),
23
24 #[error("json error: {0}")]
26 Json(#[from] serde_json::Error),
27
28 #[error("huggingface hub error: {0}")]
30 Hub(#[from] hf_hub::HFError),
31
32 #[error("unsupported or invalid model config: {0}")]
34 UnsupportedArchitecture(String),
35
36 #[error("missing model tensor `{0}`")]
38 MissingWeight(String),
39
40 #[error("invalid argument: {0}")]
42 InvalidArgument(String),
43}
44
45const _: () = {
46 const fn assert_send_sync<T: Send + Sync + 'static>() {}
47 assert_send_sync::<ModelError>();
48};