Skip to main content

Crate weirdnet_model

Crate weirdnet_model 

Source
Expand description

Weirdnet local models.

  • catalog: pinned Gemma 4 E2B and E4B GGUF files (Hugging Face repo, file, size, SHA-256).
  • store and download: where model files live (list and remove them too), and a consent-gated download that resumes a .part file and checks size and SHA-256 before the file appears, for single and split models.
  • hf: search the Hugging Face Hub, read a repo’s GGUF files (split files grouped) and a file’s header, so any repo can become a ModelSpec; HfToken for gated repos, read on the downloading node only.
  • gguf: the GGUF header fields that size the KV cache.
  • fit: pick the largest file whose weights and KV cache fit the memory budget.
  • prompt: render chat turns with the model’s own Jinja template, and the <tool_call> tag format for tools (prompt text and a streaming parser).
  • worker: an Engine on its own thread, streaming text with cancel.
  • cpu: whether this CPU can run the compiled-in llama.cpp (checked before it loads).
  • hw: what accelerators and memory this machine has, the memory budget for models, a tiered catalog with footprints, and hw::plan to pick models that fit.
  • llama (feature): the llama.cpp Engine.
  • agent (feature): weirdnet_agent::ModelBackend over the worker.

Nothing here knows an app: callers pass paths, consent and callbacks.

Re-exports§

pub use catalog::Device;
pub use catalog::ModelSpec;
pub use catalog::human;
pub use download::Consent;
pub use download::Progress;
pub use download::download;
pub use download::download_parts;
pub use hf::Hub;
pub use prompt::ChatMessage;
pub use prompt::ChatRole;
pub use store::ModelStore;
pub use store::StoredModel;
pub use token::HfToken;
pub use worker::Chunk;
pub use worker::Engine;
pub use worker::GenerateRequest;
pub use worker::Generation;
pub use worker::Stats;
pub use worker::Worker;

Modules§

catalog
Which model files Weirdnet knows how to fetch.
cpu
Can this CPU run the llama.cpp compiled into this build?
download
Consent-gated download of one model file, or every part of a split model: resumes a .part, checks the size and the SHA-256, and only then renames it into place. Requests carry the store’s Hugging Face token when it may go to the store’s Hub (see ModelStore::from_env).
fit
Which file of a repo to download: the largest quantization whose weights plus KV cache fit the node’s memory Budget.
gguf
The parts of a GGUF header that size a model’s KV cache, read from the start of the file (over HTTP with a Range request, see Hub::gguf_info).
hf
Hugging Face Hub: search for GGUF repos, read a repo’s GGUF files (split files grouped into one model), read a file’s header for KV sizing, so any repo can become a ModelSpec.
hw
Hardware detection and model sizing.
prompt
Chat prompts: the model’s own Jinja template, a Gemma-style fallback, and the <tool_call> tag format for tools.
store
Where model files live on disk, and which Hub they come from.
token
A Hugging Face access token, for gated and private repos.
worker
Inference on a worker thread: callers submit a request and read streamed text, and can cancel.

Enums§

Error
Everything that can go wrong here.

Type Aliases§

Result