The pieces / weirdnet-model

weirdnet-model

Local models: consent-gated Hugging Face GGUF downloads with resume and checksum, Hub search and split GGUFs, picking the largest file that fits, LoRA adapter files (GGUF and PEFT), importing and checking local model files with provenance, a Gemma 4 catalog with chat (GGUF and vLLM checkpoints), speech-to-text (GGUF and vLLM checkpoints) and text-to-speech models, cited speech profiles, sharded checkpoints and per-entry engine arguments, per-model media limits measured when a model loads, hardware detection and model sizing, and streaming llama.cpp inference on a worker thread with cancel.

v0.5.7 GitHub crates.io docs.rs weirdnet-model = "0.5.7"

What it brings

Run a small language model on the user's own machine, for any WeirdBrains app, without each app writing its own download, checksum and inference plumbing. Nothing downloads until the user has agreed to that exact model, and llama.cpp and the agent backend are optional features, so a build that only needs the catalog and downloads has no native dependencies.

What it is

The shared local-model layer for WeirdBrains apps. It downloads a GGUF only after the user agrees to that exact model, loads it with llama.cpp and streams tokens from one worker thread that any thread can cancel. It was extracted from Mouser’s mouser-llm and has no app-specific types; switching Mouser over to it is a follow-up for Mouser’s owner in progress.

llama.cpp and the agent backend are optional features, so a build that only needs downloads and the catalog has no native dependencies.

How it works

Get a model

catalog holds the Gemma 4 E2B (phones, small laptops) and E4B (desktop) GGUF defaults with repo, file, size and checksum, and catalog::default_for(Device) picks one. ModelStore is a cache directory (WEIRDNET_MODELS_DIR overrides it). download needs a Consent for exactly that model, reports Progress, resumes from a .part file and verifies the SHA-256. hf lists a repo's GGUF files and sizes for a model picker.

Find a model that fits (0.5.1)

hf::Hub searches the Hugging Face Hub for GGUF repos (Search, SearchHit) and groups a repo's files into models: split GGUFs (-00001-of-00003.gguf) become one model with their parts, and the quantization is read from the file name (RepoModel, group_files, quant_of). gguf_info reads a file's header with a Range request, and gguf::read_info gives the fields that size the KV cache. fit::choose picks the largest file whose weights and KV cache fit a hw::Budget for the context and slots asked for, and fit::rank measures every file against it; without a header the KV cache is estimated from the file size. download_parts fetches every part of a split model under one consent, and ModelStore::list and remove_local show and delete what is on disk.

A Hugging Face token (HfToken) is read on the machine that downloads, from HF_TOKEN, HUGGING_FACE_HUB_TOKEN or a token file. ModelStore::from_env sends it to the public Hub only, never to another host; ModelStore::with_token sets one for any Hub.

LoRA adapters (0.5.2)

A GGUF can hold a model or a LoRA adapter. gguf::read_header returns a GgufHeader whose GgufKind is Model, Adapter { adapter_type, alpha } or, since 0.5.3, Projector, and Hub::gguf_header reads it from the Hub with a Range request. Hub::adapters lists a repo's adapter files as RepoAdapters, GGUF LoRA or PEFT (AdapterFormat), with the base model hinted from the repo (hf::adapter_hint); Search::with_adapters finds adapter repos and marks them in SearchHit::adapter. download_adapter needs Consent::given_adapter for that adapter and saves it under adapters/<id>/ with an adapter.json; ModelStore::adapters lists the StoredAdapters on disk and remove_adapter deletes one. Adapters never show up in Hub::models, fit, ModelStore::list or plain searches, so a model picker doesn't offer them as models. weirdnet-backends 0.4 serves them on a base model.

Import local files (0.5.3)

Models trained or converted on the user's machine come in through artifact::inspect: it reads and hashes local files (GGUF models, split models, LoRA adapters and vision projectors; safetensors and MLX model directories; PEFT adapters), reads their headers, and refuses pickles, code and symlinks. The Artifact it returns has an ArtifactKind, an ArtifactFormat, the ArtifactFiles with their SHA-256s, and a content revision that is the same wherever the same files are. ModelStore::import (and import_replacing, import_with, import_files) checks the files again and places them atomically, GGUFs as before and directories under safetensors/<id>/, mlx/<id>/ or projectors/<id>/, with a provenance.json: a Provenance (weirdnet-provenance/1) naming the origin (upload, training or the Hub), the base model, the dataset, the trainer and the app. StoredModel::provenance and StoredAdapter::provenance read it back; dir_models, projectors and remove_projector list and delete the new layouts. free_bytes and disk_space say how much room is left, and bytes_by_origin how much is stored from one origin, for quotas.

Run it

Worker: one thread owns the Engine; Worker::generate returns a Generation that streams Chunks and can be cancelled from any thread. prompt renders chat turns through the model's own chat template and parses <tool_call> tags into tool calls as they stream. With the agent feature, agent::LocalModel implements weirdnet_agent::ModelBackend, so the agent loop can run on a local model. Since 0.5.0 (weirdnet-agent 0.5) it reads text parts and refuses messages with images or audio. Tests use a mock Engine and never download a model.

Hardware and sizing (0.4.0)

hw::detect() reports the OS, CPU threads, system memory and GPUs: NVIDIA through nvidia-smi (name, memory, compute capability, driver), AMD through sysfs, and Apple silicon. Devices that share system memory (Apple, GB10, AMD APUs) are marked unified. It never fails; a missing tool means fewer devices.

hw::budget(&hw, memory_budget, reserve) is the memory models may use: 85% of VRAM, or 85% of unified memory after an OS reserve (an eighth of RAM, at least 4 GiB). Both can be overridden. hw::catalog() is a tiered list from SmolLM2 135M through Gemma 4 E2B and E4B, Qwen3 8B, 14B, 30B-A3B and 32B and gpt-oss 20B, plus Qwen3 Embedding 0.6B, (since 0.5.4) Voxtral Mini 3B for speech to text, (since 0.5.5) eight text-to-speech models and (since 0.5.6) Caveling 2 Mini and three speech-to-text checkpoints for vLLM and (since 0.5.7) Inkling 2 Mini, Qwen3-VL 8B and Qwen3.8 27B NVFP4. Each entry has a pinned ModelSpec (so it downloads through the consent gate) and a footprint: the file, the KV cache for its context and slots, and 10% headroom. hw::plan(&hw, budget) picks the largest chat model that fits, a Gemma 4 stand-in and the embedding model. CPU-only machines only get models with at most 4B active parameters, so answers stay usable.

Speech to text (0.5.4)

Every catalog entry has a Purpose, its role on a node: chat, embedding or transcribe (Purpose::as_str and Purpose::parse give the names). The transcribe entry is Voxtral Mini 3B (hw::VOXTRAL_MINI_3B, Q4_K_M), which llama.cpp runs with its audio encoder: CatalogEntry::projector() is that pinned mmproj file, downloaded through the same consent gate and counted in footprint. Audio goes in as an input_audio part and the transcript comes back as text, so a soundtrack can become text for models without audio. hw::plan never proposes it; hw::transcriber(&budget) returns it when it fits, and hw::by_purpose lists entries by role.

Text to speech (0.5.5)

The speak role (Purpose::Speak) is text in, audio out. Each entry has a speech::SpeechProfile (CatalogEntry::speech()): its preset voices, whether it designs a voice from a description, takes style instructions, clones a voice from a reference clip (and whether the clip's transcript is used or required), speaks multi-speaker scripts, takes raw input or a speed, streams; its languages, output formats and sample rate; and its limits. Every field is cited to the model's card and its engine's documentation (llama.cpp's TTS notes and the llama-server README, or vLLM-Omni's speech API), or absent.

  • Qwen3-TTS, one id per checkpoint: qwen3-tts-0.6b-customvoice and qwen3-tts-1.7b-customvoice (nine preset voices; the 1.7B also takes style instructions), qwen3-tts-1.7b-voicedesign (a voice from a description) and qwen3-tts-0.6b-base (cloning, transcript optional) are the Qwen repos vLLM-Omni serves; qwen3-tts-1.7b-base is ggml-org's GGUF, whose projector has the speaker encoder only, so llama.cpp clones from the clip alone.
  • kokoro-82m: the 54 voices in its projector (af_heart first), English from text, other languages as raw phonemes, speed.
  • voxcpm2: voice design and cloning from a clip (its first 30 seconds), 30 languages, 48 kHz.
  • fish-audio-drama-3: scripts of up to 16 speakers in 83 languages. ggml-org's projector has no codec encoder, so this entry does not clone. It is under the Fish Audio Community License: CatalogEntry::restricted(), never picked by hw::speaker, and download refuses its files (by id, or from its repos under any id) unless the Consent also has accepting_license("fish-audio-community"), given only after the operator has read it.

GGUF entries (CatalogEntry::is_gguf) pin the model and its projector, both counted in footprint; the others pin the main weights of the repo vLLM-Omni serves. hw::speaker(&budget) returns the largest unrestricted GGUF speaker that fits. A GGUF speech model placed by hand gets its profile from its headers: speech::from_gguf(model, projector) reads the projector's generator type, its reference encoder, the voices stored in it and the model's languages and license, and limits::measure keeps the result in LimitsRecord::speech, so weirdnet-backends can merge it with what the engine reports at load (SpeechProfile::or) and publish it through weirdnet-agent's SpeechProfile (to_agent, the same wire form).

vLLM transcribers, sharded checkpoints and engine arguments (0.5.6)

Three more transcribe entries are Hugging Face checkpoints for vLLM with vllm[audio], not GGUFs: qwen3-asr-1.7b (Qwen3-ASR 1.7B, Apache-2.0, two safetensors shards), whisper-large-v3-turbo (Whisper large-v3-turbo, MIT, 30 second windows, limits::WHISPER_CHUNK_SECONDS) and cohere-transcribe-03-2026 (Cohere Transcribe 03-2026, Apache-2.0, gated). spec.repo is the repo vLLM serves and CatalogEntry::revision() the Hub commit the sizes and SHA-256 were read at, for vLLM's --revision. hw::transcriber keeps to the GGUF entries llama.cpp runs; hw::by_purpose(Purpose::Transcribe) lists all four.

An entry's spec is one file with one hash. A checkpoint in several files keeps its first shard in spec and lists every shard, each with its own size and SHA-256, in CatalogEntry::files(). The shards share the entry's id, so one Consent covers them and download_parts fetches them together and checks each hash; an entry with one file lists just spec, and footprint counts every shard.

let asr = hw::find(hw::QWEN3_ASR_1_7B).unwrap();
for shard in asr.files() {
    println!("{} {} bytes sha256 {}", shard.file, shard.size, shard.sha256.as_deref().unwrap());
}
let consent = Consent::given(&asr.spec);
download_parts(&store, &asr.files(), &consent, &mut |_| true)?;

CatalogEntry::engine_args() is what an entry needs on its engine's command line besides the arguments an app sets for every model: vLLM arguments for a checkpoint, llama-server arguments for a GGUF entry. An app appends them to the launch's extra arguments, after the operator's own. Cohere Transcribe's repo ships its modeling code, so vLLM needs --trust-remote-code. A gated repo (CatalogEntry::gated(), hw::gated(&spec)) needs its terms accepted on the Hub and a token on the downloading node (HF_TOKEN); download says so before sending a request when the store has none.

let cohere = hw::find(hw::COHERE_TRANSCRIBE_03_2026).unwrap();
let mut extra_args: Vec<String> = Vec::new(); // the operator's own
extra_args.extend(cohere.engine_args().iter().map(|a| a.to_string())); // ["--trust-remote-code"]

Caveling 2 Mini (0.5.6)

caveling-2-mini is Caveling 2 Mini, caveman-so's Apache-2.0 fine-tune of Inkling 2 Mini (26B mixture of experts, 3.4B active, text and vision) that spends about 43% fewer reasoning tokens. The entry pins the Q4_K_M GGUF and the Q8_0 vision projector (CatalogEntry::projector); the repo also holds an NVFP4 file, a draft model for speculative decoding and an importance matrix, which are not the chat model, so hf::parse_files leaves the drafter (dspark-) and the matrix (imatrix) out. It runs at a context of 346112 tokens (launch_context(), the figure its footprint is sized at) with launch_gpu_layers() of 99 and engine_args() of -fa on --jinja. hw::plan still prefers the larger Qwen3 models that fit.

Inkling 2 Mini and vLLM chat checkpoints (0.5.7)

inkling-2-mini is the model Caveling 2 Mini is fine-tuned from: Inkling 2 Mini from Thinking Machines (Apache-2.0), as ggml-org’s GGUF. It has the same shape and the same launch values (346112 tokens, 99 layers, -fa on --jinja) and pins the IQ4_NL file (17.6 GB; the repo also holds BF16, Q8_0 and NVFP4 files and an importance matrix) and the Q8_0 vision projector. Both entries size the KV cache at eight full-context layer caches per token (four attention layers, two of them in the looped core, which keeps a cache for each of its three passes), so Caveling’s footprint is larger than in 0.5.6.

qwen3-vl-8b (four shards) is Qwen3-VL 8B Instruct (Apache-2.0; text, images and video) and qwen3.8-27b-nvfp4 (three shards) is RadixArk’s NVFP4 quantization of Qwen3.8 27B (Apache-2.0; its card names SGLang and NVIDIA Blackwell GPUs). They are Hugging Face checkpoints that vLLM serves, not GGUF files (CatalogEntry::is_gguf() is false): like the speech-to-text checkpoints they list every shard in files() with its own hash and carry the Hub commit in revision(), and hw::plan never picks them. An app that runs vLLM chooses one with hw::by_purpose(Purpose::Chat).

Model limits (0.5.4)

A client fitting images, audio or a video's frames to a model needs that model's limits, and none are defaulted: what isn't known stays absent. ModelLimits holds the context the model runs with on the node (per slot, not the trained context), images per request, what an image costs (a fixed number, or one token per image_patch pixels square up to image_tokens), the longest image edge, audio length and cost (audio_tokens_per_minute, and audio_chunk_seconds with audio_chunk_tokens for encoders that take 30-second pieces, so a short clip costs a whole piece), video_max_seconds, video_max_bytes, video_frames_per_minute (0.5.5) and max_request_bytes. or puts an operator's settings over measured ones, tightest merges copies, and image_cost and audio_cost price one input. With the agent feature, to_media and from_media convert to and from weirdnet-agent's MediaLimits for catalog entries, video limits included since 0.5.5.

When a node loads a model, limits::measure(model, projector, context) reads the GGUF and its projector into a LimitsRecord (weirdnet-limits/1): what the projector's header says images and audio cost (from_projector, from gguf::ProjectorInfo; Gemma 3 images cost 256 tokens, Qwen-VL one token per 28 pixels square, Voxtral and Ultravox 187 tokens per 30 seconds of audio, Qwen2 audio 750), the context passed in and the trained context for reference. Other projector types are left absent. ModelStore::record_limits keeps the record next to the model's files, StoredModel::limits reads it back until the files change size, and remove_local deletes it with the model. LlamaEngine::limits gives the context the engine runs with.

CPU support (0.2.0)

llama.cpp's build turns on AVX, AVX2, BMI2, FMA and F16C by default, so a plain llama build only runs on x86 CPUs that have them (roughly Haswell and Excavator, 2013 to 2015, and later). Two things keep older CPUs from crashing with an illegal instruction:

  • The guard, always on. build.rs works out which instructions the linked llama.cpp contains. LlamaEngine::load calls cpu::check() first and returns Error::UnsupportedCpu { missing } on a CPU without them; llama::describe() then says llama.cpp (unsupported CPU). An app can call cpu::check() itself to hide local models, or to offer another machine instead.
  • cpu-dispatch, for release binaries that should run local models on any CPU. ggml is built once per CPU level (x86 from baseline x86-64 up to the AVX-512 levels; ARM from armv8.0 to armv9.2, Apple M1 to M4) and each library is asked at load time whether this CPU can run it, keeping the best. Speed on a modern CPU matches the static build. The price: llama.cpp becomes shared libraries the app must ship, and without them the app does not start at all.

What to ship with cpu-dispatch: libllama, libllama-common, libggml and libggml-base, which the executable links against (point its rpath at them on Linux and macOS, or put the DLLs next to the .exe on Windows), and one libggml-cpu-<level> library per level, plus libggml-vulkan or libggml-metal with those features. They load from llama::backends_dir(): the directory given to llama::set_backends_dir, else WEIRDNET_GGML_BACKENDS_DIR, else the executable's directory; the working directory is never searched. If none loads, loading a model fails with Error::NoCpuBackend. The README's measured example on x86-64 Linux is a 4.3 MB executable plus 35 MB of libraries, against 9.4 MB for the static example.

Without cpu-dispatch, a static build can run everywhere at a speed cost by building ggml for an older level, for example GGML_AVX=OFF GGML_AVX2=OFF GGML_BMI2=OFF GGML_FMA=OFF GGML_F16C=OFF (SSE4.2 and later); the guard follows those variables. ARM builds need nothing. Don't use target-cpu=native for anything you distribute.

Known build limits (README, 0.2.0). llama-cpp-sys-2 0.1.161's shared-library build fails with Rust 1.100's build directory layout, so build cpu-dispatch with Rust 1.99 for now. A second build in the same target directory can fail with "File exists" on the library symlinks; deleting the lib*.so* symlinks under target/<profile>/ between builds avoids it. The static llama build has neither problem.

Key types and modules

  • catalog: Gemma 4 E2B (about 2.8 GB, for phones and small laptops) and E4B (about 4.6 GB, for desktop) as Q4_0 GGUFs from ggml-org on Hugging Face, with pinned size and SHA-256. default_for(Device) picks one.
  • ModelStore, download: a cache directory (WEIRDNET_MODELS_DIR overrides it), a Consent that must name the model, Progress callbacks, .part resume and a checksum check before the file is kept. Nothing downloads without consent.
  • hf: lists a repo’s GGUF files and sizes for a model picker. hf::Hub (0.5.1) searches the Hub (Search, SearchHit), groups a repo’s files into models with split GGUFs joined and the quantization read from the name (RepoModel, group_files, quant_of), and reads a file’s GGUF header with a Range request (gguf_info).
  • fit (0.5.1): choose and rank pick the largest file whose weights and KV cache fit a hw::Budget for the context and slots asked for (FitOptions, Fit); gguf::read_info gives the header fields that size the KV cache, with an estimate when the header isn’t read.
  • HfToken (0.5.1): a Hugging Face token read on the downloading machine (HF_TOKEN, HUGGING_FACE_HUB_TOKEN or a token file). ModelStore::from_env sends it to the public Hub only; ModelStore::with_token sets one for any Hub.
  • download_parts, ModelStore::list, ModelStore::remove_local (0.5.1): every part of a split model under one consent, the models on disk with split parts grouped, and removal.
  • gguf::read_header, adapters (0.5.2): GgufKind says whether a GGUF is a model or a LoRA adapter (Adapter { adapter_type, alpha }); Hub::adapters lists a repo’s adapter files (RepoAdapter, AdapterFormat::{GgufLora, Peft}), Hub::gguf_header reads one over a Range request and Search::with_adapters finds them; download_adapter with Consent::given_adapter saves one under adapters/<id>/, and StoredAdapter, ModelStore::adapters and remove_adapter list and delete them. Adapters stay out of Hub::models, fit and ModelStore::list.
  • artifact, ModelStore::import (0.5.3): artifact::inspect reads and hashes local files (GGUF models, split models, LoRA adapters and projectors; safetensors and MLX model directories; PEFT adapters) and refuses pickles, code and symlinks, returning an Artifact; ModelStore::import (import_replacing, import_with, import_files) places it atomically with a Provenance (provenance.json: base, dataset, trainer, app). GgufKind::Projector, projectors and remove_projector handle vision projectors; free_bytes, disk_space and bytes_by_origin report space.
  • prompt: chat turns rendered through the model’s own chat template, and a streaming parser that turns <tool_call> tags into tool calls.
  • Worker, Engine: the engine lives on one thread; generate returns a Generation that streams Chunks and cancels from any thread. Tests use a mock engine.
  • llama feature: LlamaEngine on llama.cpp (CPU; needs cmake and a C++ compiler). vulkan and metal add GPU offload.
  • hw (0.4.0): detect() finds GPUs (NVIDIA, AMD, Apple silicon), CPU threads and memory; budget() is the memory models may use; catalog() is a tiered list of chat and embedding models with footprints; plan() picks a main model, a stand-in and an embedding model that fit.
  • Speech to text (0.5.4): Purpose::Transcribe, the transcribe role (Purpose::as_str, parse), and a catalog entry for Voxtral Mini 3B (hw::VOXTRAL_MINI_3B, Q4_K_M) with its pinned audio projector (CatalogEntry::projector, counted in footprint). hw::transcriber returns it when it fits and hw::by_purpose lists entries by role; plan() never picks it.
  • Text to speech (0.5.5): Purpose::Speak (the speak role) and eight catalog entries, each with a speech::SpeechProfile cited to its model card and engine docs (CatalogEntry::speech): Qwen3-TTS 0.6B and 1.7B CustomVoice, 1.7B VoiceDesign and 0.6B Base (the Qwen repos vLLM-Omni serves) and 1.7B Base, Kokoro 82M, VoxCPM2 and Fish Audio Drama 3 (ggml-org GGUFs with pinned projectors). hw::speaker returns the largest unrestricted GGUF speaker that fits; plan() never picks one. Drama 3 is under the Fish Audio Community License: CatalogEntry::restricted, and download refuses its files without Consent::accepting_license("fish-audio-community") (hw::restricted_license). speech::from_gguf gives a hand-placed GGUF speech model its profile from its headers (Kokoro’s voices from its projector), and limits::measure keeps it in LimitsRecord::speech. With agent, SpeechProfile converts to and from weirdnet-agent’s, with the same wire form.
  • Catalog entries for vLLM and a chat model (0.5.6): the transcribe role gains three Hugging Face checkpoints for vLLM with vllm[audio], Qwen3-ASR 1.7B (hw::QWEN3_ASR_1_7B, Apache-2.0, two shards), Whisper large-v3-turbo (hw::WHISPER_LARGE_V3_TURBO, MIT) and Cohere Transcribe 03-2026 (hw::COHERE_TRANSCRIBE_03_2026, Apache-2.0, gated, needs --trust-remote-code); and Caveling 2 Mini (hw::CAVELING_2_MINI, Apache-2.0), a chat model with a vision projector. CatalogEntry::revision is the Hub commit the sizes and hashes were read at. hw::transcriber still picks among the GGUF entries only.
  • Sharded entries and engine arguments (0.5.6): CatalogEntry::files lists every weights file as a ModelSpec with its own size and SHA-256 (the first is spec; all share the entry’s id, so one Consent covers download_parts), with is_sharded and weights_bytes; an entry with one file lists just spec. CatalogEntry::engine_args is what the entry needs on its engine’s command line besides an app’s own arguments (vLLM’s --trust-remote-code for Cohere Transcribe; -fa on --jinja for Caveling 2 Mini), with launch_context and launch_gpu_layers. CatalogEntry::gated and hw::gated mark a repo that needs a Hugging Face token; download says so before sending a request.
  • Inkling 2 Mini and vLLM chat checkpoints (0.5.7): Inkling 2 Mini (hw::INKLING_2_MINI, Apache-2.0), the model Caveling 2 Mini is fine-tuned from, as the IQ4_NL GGUF with its Q8_0 vision projector and the same launch values as Caveling; Qwen3-VL 8B Instruct (hw::QWEN3_VL_8B, Apache-2.0, four shards) and RadixArk’s NVFP4 Qwen3.8 27B (hw::QWEN3_8_27B_NVFP4, Apache-2.0, three shards, for NVIDIA Blackwell GPUs), checkpoints that vLLM serves. hw::plan proposes GGUF models only, so it never picks the vLLM checkpoints; an app that runs vLLM picks one with hw::by_purpose.
  • limits (0.5.4): ModelLimits holds the context a model runs with, images per request and their token cost, audio length and cost (per minute and per 30-second piece), video length, bytes and frames per minute (0.5.5), and the largest request, each absent when unknown. limits::measure reads a model and its projector when it loads (from_projector: Gemma 3, Qwen-VL, Voxtral, Ultravox and Qwen2 audio projectors), ModelStore::record_limits keeps the LimitsRecord next to the files and StoredModel::limits reads it back. With agent it converts to and from weirdnet-agent’s MediaLimits, video fields included since 0.5.5.
  • agent feature: LocalModel implements weirdnet_agent::ModelBackend (weirdnet-agent "0.5" since 0.5.0; "0.4" in 0.4.2 and 0.4.3; =0.4.0 in 0.4.0 and 0.4.1; =0.3.0 in 0.3.0), streaming text to the agent loop and returning parsed tool calls. It is text only: it reads text parts and refuses messages with images or audio (ModelError::Unavailable).
  • cpu-dispatch feature (0.2.0): llama.cpp built for every CPU level and chosen at run time, so a release binary runs local models on any CPU; the app ships the llama.cpp shared libraries (see the guide).
  • cpu (0.2.0): cpu::check(), required() and missing() say whether this CPU can run the compiled-in llama.cpp. LlamaEngine::load checks first and returns Error::UnsupportedCpu instead of crashing with an illegal instruction.
  • examples/model.rs (0.2.0): a small CLI with the llama feature. fetch [id] downloads a model with progress (running the command is the consent) and checks its size and SHA-256; chat [id] "question" loads it and streams the answer with load, first-chunk and total timings. The cpu command prints the CPU check. Run from a clone: cargo run --release --example model --features llama -- chat gemma-4-e4b "Why is the sky blue?".

Feature flags

  • llama: LlamaEngine on llama.cpp, CPU. Needs cmake and a C++ compiler to build.
  • cpu-dispatch (implies llama): llama.cpp for every CPU level, chosen at run time; the app ships the shared libraries.
  • vulkan, metal (imply llama): GPU offload.
  • agent: agent::LocalModel, a weirdnet_agent::ModelBackend, and ModelLimits conversions to MediaLimits (weirdnet-agent "0.5.7" since 0.5.4; "0.5" in 0.5.0 to 0.5.3; "0.4" in 0.4.2 and 0.4.3; =0.4.0 in 0.4.0 and 0.4.1; =0.3.0 in 0.3.0, =0.2.0 in 0.2.1).

Usage

[dependencies]
weirdnet-model = "0.5.7"
# Cargo.toml
weirdnet-model = { version = "0.5", features = ["llama", "agent"] }

// main.rs
use std::sync::Arc;
use weirdnet_model::{agent::LocalModel, catalog, llama::{LlamaEngine, LlamaOptions}, ModelStore, Worker};

let spec = catalog::default_for(catalog::Device::Desktop);
let store = ModelStore::from_env();
// After the user agrees: weirdnet_model::download(&store, &spec, &consent, &mut on_progress)?; // on_progress returns false to cancel
let worker = Arc::new(Worker::spawn(LlamaEngine::loader(store.path(&spec), LlamaOptions::default())));
let model = LocalModel::new(spec.id.clone(), worker); // a weirdnet_agent::ModelBackend

Where it fits

  • Builds on weirdnet-agent.
  • Used by Morph (Companions, in progress).
  • License: BSD-3-Clause.
Version 0.5.7 is on crates.io (docs.rs, tag v0.5.7). 0.5.7 is additive: the catalog entries inkling-2-mini, qwen3-vl-8b and qwen3.8-27b-nvfp4 with their hw constants (INKLING_2_MINI, QWEN3_VL_8B, QWEN3_8_27B_NVFP4); hw::plan proposes GGUF chat models only (the vLLM checkpoints are listed by hw::by_purpose); and the KV cache of caveling-2-mini is sized at eight full-context layer caches per token, not four (the looped core keeps a cache for each of its three passes), so its footprint grows. No new model was run for this release; the sizes and hashes come from the Hugging Face API, and the hashes of the Inkling 2 Mini files match the files the Ymir nodes run. 0.5.6 is additive: the catalog entries caveling-2-mini, qwen3-asr-1.7b, whisper-large-v3-turbo and cohere-transcribe-03-2026 with their hw constants; CatalogEntry::files, is_sharded, weights_bytes, engine_args, launch_context, launch_gpu_layers, revision and gated; hw::gated; NVFP4 in hf::quant_of. download refuses a gated entry’s files without a token, before any request; hw::transcriber picks among the GGUF entries only; CatalogEntry::footprint counts every shard; and hf::parse_files leaves out dspark- draft models and imatrix files, which a smallest-file pick used to choose over the model. No new model was run for this release; the sizes and hashes come from the Hugging Face API. 0.5.5 is additive: Purpose::Speak, the eight text-to-speech entries and their constants, hw::speaker, hw::restricted_license, CatalogEntry::speaks, speech, license, restricted and is_gguf; the speech module (SpeechProfile, AudioFormat, CloneMode, from_gguf, restricting_license, FISH_AUDIO_COMMUNITY); Consent::accepting_license and accepts_license; LimitsRecord::speech; GgufHeader::languages and license; ProjectorInfo::speech, speech_projector, default_voice, voices, speech_type and reads_audio; ModelLimits::video_frames_per_minute. With agent, to_media and from_media carry the video limits, and the feature needs weirdnet-agent 0.5.11. Downloading Drama 3’s files now needs the license accepted. No speech model was run for this release; the GGUF profiles match the published headers. 0.5.4 is additive: Purpose::Transcribe and the Voxtral Mini 3B speech-to-text entry (hw::VOXTRAL_MINI_3B, CatalogEntry::projector, transcribes, hw::transcriber, hw::by_purpose); the limits module (ModelLimits, from_projector, measure, LimitsRecord, LimitSource); ModelStore::record_limits, limits, clear_limits, limits_path and StoredModel::limits; gguf::ProjectorInfo on GgufHeader::projector; LlamaEngine::limits. CatalogEntry::footprint now counts an entry’s projector (no existing entry has one), and the agent feature needs weirdnet-agent 0.5.7. 0.5.3 is additive: artifact (inspect, Artifact, ArtifactKind, ArtifactFormat, ArtifactFile, revision, read_safetensors, early_header, inspect_staged), Provenance (weirdnet-provenance/1), ModelStore::import, import_replacing, import_with and import_files with safetensors/<id>/, mlx/<id>/ and projectors/<id>/ layouts, dir_models, projectors, remove_projector, free_bytes, disk_space, bytes_by_origin, StoredModel::provenance and layout, StoredAdapter::provenance and GgufKind::Projector; gguf::read_header now reports projector GGUFs as projectors instead of models. 0.5.2 is additive: LoRA adapter files, from the GGUF header (gguf::read_header, GgufHeader, GgufKind, gguf::hub_id) to the Hub (Hub::adapters, Hub::gguf_header, hf::adapter_hint, Search::with_adapters, SearchHit::adapter), downloads (download_adapter, Consent::given_adapter, with an adapter.json beside the files) and the store (StoredAdapter, ModelStore::adapters, remove_adapter, adapter_dir); model listings, fits and searches leave adapters out. 0.5.1 is additive: Hub search, split GGUFs, fit, HfToken, download_parts, and listing and removing models on disk; download now creates the directory of a file in a repo subdirectory and refuses names that leave the store. 0.5.0 moves the agent feature to weirdnet-agent "0.5" (content parts): breaking for agent users only, who move to agent 0.5 with it; LocalModel reads text parts and refuses images and audio. Nothing changes without the agent feature. 0.4.3 changes only package metadata and docs, with no API changes; 0.1.0 to 0.4.2 are yanked. 0.4.2 loosens the agent feature’s weirdnet-agent requirement from =0.4.0 to "0.4", so it works with agent 0.4.1 and later 0.4 patches; nothing else changes. 0.4.1 fixes the note hw::plan() gives when no catalog chat model fits: it no longer names another application’s command and says to add a smaller GGUF model. 0.4.0 adds the hw module and makes the agent feature depend on weirdnet-agent =0.4.0 (it was =0.3.0), so apps on agent 0.4 can use LocalModel. This is breaking for agent users only; ModelBackend is unchanged and nothing changes without the agent feature. Adding variants to Error (0.2.0) is a breaking change. The API may change while Morph’s Companions are built on it. Real-model tests are ignored by default; CI builds llama.cpp on CPU only. Measured by the Morph team: Gemma 4 E4B on CPU (16 cores, warm load) takes about 1.6 s to load and give the first token, then runs at about 9 tokens/s with about 7 GiB peak RAM.