Skip to main content

Crate combs_models

Crate combs_models 

Source
Expand description

§combs-models

Model architecture registry. The runtime drives any architecture through the fixed GenerativeModel contract (MLC’s embed/prefill/decode/ create_kv_cache function set); architectures register themselves in the ModelRegistry. Phase 1 ships the Llama family (incl. SmolLM2).

Structs§

CacheConfig
Configuration for a KV cache instance.
ContiguousKVCache
Simple contiguous cache: stores one K and one V tensor per layer and concatenates along the sequence dimension every step.
LlamaModel
Llama-family causal LM.
ModelRegistry
Maps architecture identifiers (config.json::model_type, plus known aliases) to loaders. Mirrors MLC’s model.py::MODELS table.
PagedKVCache
MLC-style paged KV cache.
QuantizedLinear
y = x @ W^T (+ b) where W is stored group-quantized to 4 bits.
RotaryEmbedding
Precomputed RoPE cosine/sine tables.
SmolVlmModel
SmolVLM (Idefics3): SigLIP + connector + Llama-family text decoder.

Enums§

CacheKind
Which KVCache implementation to instantiate.
ModelError
Errors produced while constructing or running models.

Traits§

GenerativeModel
Fixed contract every generative architecture implements — the direct analog of MLC’s embed / prefill / decode / create_kv_cache function set. The runtime only ever talks to models through this trait.
KVCache
Per-layer key/value storage that owns the attention computation.

Functions§

image_prompt_expansion
Builds the Idefics3 prompt expansion for one image: <fake_token_around_image><global-img><image>×image_seq_len<fake_token_around_image>. (image_seq_len = 64 for SmolVLM-256M.) The returned string is meant to replace each <image> placeholder in the chat text.
pixels_to_tensor
Builds a [1, 3, H, W] pixel tensor from planar CHW f32 data (used by the runtime to hand media to embed_multimodal).
rms_norm
y = x / rms(x) * w where rms is taken over the last dimension and eps is added inside the square root.

Type Aliases§

Result
Convenient result alias for this crate.