mod act;
mod archspec;
mod kv;
mod llama;
mod matmul;
mod norm;
mod precision;
mod qkernel;
mod qlinear;
mod qmatmul;
mod quant_linear;
mod registry;
mod rope;
mod smolvlm;
mod traits;
mod whisper;
pub use archspec::{ArchSpec, LayerKind, NormFlavor};
pub use kv::{CacheConfig, CacheKind, ContiguousKVCache, KVCache, PageStats, PagedKVCache};
pub use llama::LlamaModel;
pub use norm::rms_norm;
pub use qlinear::{Linear, QuantLinearOp, try_quant_linear};
pub use qmatmul::{
Q4KWeight, Q5KWeight, Q6KWeight, Q40Weight, Q50Weight, Q80Weight, dequantize_q4_0_gpu,
dequantize_q4_k_gpu, dequantize_q5_0_gpu, dequantize_q5_k_gpu, dequantize_q6_k_gpu,
dequantize_q8_0_gpu,
repack_q4_0, repack_q4_k, repack_q5_0, repack_q6_k, repack_q8_0,
};
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 whisper::{WhisperModel, load_speech_model};
pub use traits::{GenerativeModel, SpeechToTextModel};
#[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("unsupported operation: {0}")]
Unsupported(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>;
#[cfg(test)]
pub(crate) fn skip_no_gpu() -> bool {
if combs_core::gpu_available() {
return false;
}
eprintln!("skipped: no wgpu adapter on this machine");
true
}