Skip to main content

Crate combs_formats

Crate combs_formats 

Source
Expand description

§combs-formats

File-format adapter layer. The runtime and model crates never touch file formats directly; they go through the ModelSource trait (the LiteRT-LM ModelResources equivalent). Phase 1 ships the [safetensors] adapter (HuggingFace config.json + model.safetensors, mmap-backed, zero-copy views). GGUF / ONNX / litertlm adapters plug in here later by implementing the same trait.

Modules§

quants
Reference CPU dequantizers for GGUF quant formats. These scalar implementations are the harmony reference that the fused GPU kernels in combs-models validate against: every kernel is tested against a portable reference.

Structs§

AttentionPattern
Attention RoPE/scale settings that vary by layer type (Gemma2/3): pattern-th layers are “global” (full attention, rope_theta); the rest are “local” (sliding-window attention, rope_local_theta).
GgufSource
A parsed GGUF file.
ModelMetadata
Architecture + hyperparameter description of a model, format-agnostic.
QuantTensor
A quantized tensor’s packed bytes, exactly as stored in the file.
SafetensorsSource
ModelSource over a HuggingFace-format directory.
SamplerConfig
Default sampler parameters, typically from generation_config.json.
SectionInfo
A section directory entry.
TensorReader
A lazy view over one tensor’s raw bytes inside a ModelSource.
TfliteSource
A TFLite model file as a ModelSource (Gemma-family exports).
TokenizerSpec
Where to find the tokenizer and which special tokens it defines.
VisionConfig
Vision-encoder hyperparameters parsed from config.json::vision_config (plus top-level scale_factor / image_token_id).

Enums§

Activation
MLP activation function, parsed from hidden_act/hidden_activation. The tanh-approximation family (gelu_pytorch_tanh, gelu_new, gelu_fast) all map to Activation::GeluTanh.
FormatError
Errors produced by format adapters.
QuantFormat
GGUF quant formats with a native device kernel (see combs-models).
RopeScaling
RoPE frequency scaling, parsed from HF rope_scaling (accepts both the modern rope_type and the legacy type key). Table math lives in combs-models::rope; this is parse-only.
TensorDtype
Element dtypes supported by the loaders.

Traits§

ModelSource
The central adapter trait: a source of model weights + config, independent of the on-disk format (LiteRT-LM ModelResources equivalent).

Functions§

ensure_tokenizer_json_from_spm
Ensures a tokenizer.json exists for a SentencePiece .model file, converting + caching it next to the source on first use. Returns the path (idempotent: an existing cache is reused).
litertlm_read_sections
Reads the section directory of a .litertlm file header.
open_model_source
Opens any supported model path: a .gguf file, or a directory in the HuggingFace safetensors layout. This is the single entry point the CLI, FFI and server use — format detection lives here.
spm_added_tokens
Parses a SentencePiece model and returns its special-token map (id → string), for TokenizerSpec.added_tokens.

Type Aliases§

Result
Convenient result alias for this crate.