mod kv;
mod llama;
mod matmul;
mod norm;
mod quant_linear;
mod registry;
mod rope;
mod smolvlm;
mod traits;
pub use kv::{CacheConfig, CacheKind, ContiguousKVCache, KVCache, PagedKVCache};
pub use llama::LlamaModel;
pub use norm::rms_norm;
pub use quant_linear::QuantizedLinear;
pub use registry::ModelRegistry;
pub use rope::RotaryEmbedding;
pub use smolvlm::{SmolVlmModel, image_prompt_expansion, pixels_to_tensor};
pub use traits::GenerativeModel;
#[derive(Debug, thiserror::Error)]
pub enum ModelError {
#[error(transparent)]
Format(#[from] combs_formats::FormatError),
#[error("unsupported architecture: {0}")]
UnsupportedArchitecture(String),
#[error("unsupported media input: {0}")]
UnsupportedMedia(String),
#[error("missing weight tensor: {0}")]
MissingTensor(String),
#[error("bad shape for {tensor}: expected {expected:?}, got {got:?}")]
BadShape {
tensor: String,
expected: Vec<usize>,
got: Vec<usize>,
},
}
pub type Result<T> = std::result::Result<T, ModelError>;