alter_ego / serving /src /error.rs
geraldaton20's picture
initial upload: source code (no build artifacts)
f4f166e verified
Raw History Blame Contribute Delete
880 Bytes
use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Error)]
pub enum Error {
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("json error: {0}")]
Json(#[from] serde_json::Error),
#[error("checkpoint format error: {0}")]
Checkpoint(String),
#[error("model error: {0}")]
Model(String),
#[error("shape mismatch: expected {expected:?}, got {got:?} for tensor {name}")]
Shape {
name: String,
expected: Vec<usize>,
got: Vec<usize>,
},
#[error("missing tensor {0} in checkpoint")]
MissingTensor(String),
#[error("unsupported dtype {0}")]
Dtype(String),
#[error("shape error: {0}")]
Shapes(String),
}
impl From<ndarray::ShapeError> for Error {
fn from(e: ndarray::ShapeError) -> Self {
Error::Shapes(e.to_string())
}
}