Skip to main content

Module limits

Module limits 

Source
Expand description

Per-model limits for media and requests, and the record a node keeps of them.

What a client needs to fit images, audio (or a video’s frames and soundtrack) to one model: the context the model runs with, images per request and what one costs, audio length and what it costs, and the largest request. Every field is absent when it isn’t known, never defaulted, so a client can say what is missing instead of guessing.

  • ModelLimits: the figures, with or (operator settings over measured ones), tightest and cost helpers. With the agent feature they convert to and from weirdnet_agent::MediaLimits, which catalog entries carry.
  • from_projector: what a llama.cpp projector’s header (mmproj) says images and audio cost, for the projector types whose costs follow from the header alone.
  • measure: read a model’s GGUF (and its projector) when it loads, with the context the node runs it at, into a LimitsRecord; ModelStore::record_limits keeps it next to the model’s files and StoredModel::limits reads it back.

Costs from headers follow llama.cpp’s mtmd (2026-11): a flag such as --image-max-tokens changes them, so a node that passes one sets the result over the header’s with ModelLimits::or.

Structs§

LimitsRecord
A model’s limits as a node found them when it loaded the model, kept next to its files (ModelStore::record_limits). Unknown fields are kept in extra and written back.
ModelLimits
Media and request limits for one model. See the module docs.

Enums§

LimitSource
How a LimitsRecord’s figures were found.

Constants§

LIMITS_FILE
The limits record’s name inside a safetensors or MLX model directory.
LIMITS_FORMAT
LimitsRecord::format.
LIMITS_SUFFIX
The name a GGUF model’s limits record gets next to its first file: <file>.limits.json.
WHISPER_CHUNK_SECONDS
Seconds of audio llama.cpp’s Whisper-style encoders take at a time (3000 mel frames at 16 kHz with a 160-sample hop); longer audio is cut into pieces this long, the last one padded.

Functions§

from_projector
What image and audio inputs cost, from a projector’s header, for the projector types whose costs follow from the header alone (as llama.cpp’s mtmd computes them, 2026-11):
measure
Reads a GGUF model (the first file of a split model) and its projector, if any, as a node loads them, into a record: what the projector’s header says images and audio cost (from_projector), the context the node runs the model at (context_tokens, per slot; None when the caller doesn’t know it, never the trained context) and the trained context for reference. A speech model’s projector also gives its speech profile (LimitsRecord::speech, see speech::from_gguf). Fails when model is not a GGUF model or projector not a projector.