Expand description
The Weirdnet model-node wrapper.
A model node runs models and takes requests, like a llama.cpp or vLLM server (it can be one: a stock server it only wraps). This crate starts and stops the engines and serves them; it decides nothing beyond the node: what to load is the caller’s decision.
engine: how llama.cppllama-server,vllm serveand MLX-LM’smlx_lm.serverare launched and probed, each model’sCapabilities(chat, embeddings, images, audio), andWrapfor a stock OpenAI-compatible server on loopback, andLoraAdapters served next to a llama.cpp or vLLM base model.mlx: installing a pinnedmlx-lminto a venv, and the proxy the supervisor puts in front ofmlx_lm.server(API key check, readiness after a one-token completion,default_modelrewrite, text only).supervisor: the local supervisor: load (random loopback port, per-process API key in the environment, readiness probe), drain and unload, swap groups, idle unload, crash restarts with backoff and crash loops, aReservationthat holds the node’s GPU for one job (nothing is placed there until it is released),SupervisorEvents and per-model logs; chat, completion and embedding forwarding; adapters routed to their base (AdapterChange).sse: OpenAI server-sent events decoded intoChunks, andToolCallsto join streamed tool calls.openai: engine request bodies fromweirdnet-agentinfer/2 requests.host:ModelHost, aweirdnet-agentInferHostserving raw infer/2 from the supervisor’s models.node(feature):/weirdnet-backends/node/1overweirdnet-net: signed capability records,Load,Unload,Drain,Reserve/Release,GroupUp/GroupDownand health.models(featurenode):/weirdnet-backends/models/1, for the owner only: search the Hugging Face Hub, see which files fit the node, pull (split GGUFs too) and serve without a restart, list and remove; LoRA adapters for a served base too.
Platforms: the supervisor runs on Unix and Windows. On Unix an engine gets its own process group, stops with SIGTERM then SIGKILL after a grace period, and on Linux dies with its parent; on Windows the engine process is killed outright and processes it started are not. vLLM runs on Linux only; MLX-LM on macOS on Apple silicon only.
Re-exports§
pub use engine::Capabilities;pub use engine::EngineConfig;pub use engine::EngineKind;pub use engine::LoraAdapter;pub use engine::ModelLaunch;pub use engine::Wrap;pub use engine::find_in_path;pub use host::EngineModel;pub use host::ModelHost;pub use host::RAW_INFER_PROTOCOL;pub use host::RawInferDialer;pub use host::Speed;pub use openai::Target;pub use sse::Chunk;pub use sse::ChunkDecoder;pub use sse::SseParser;pub use sse::ToolCalls;pub use supervisor::AdapterChange;pub use supervisor::ChunkStream;pub use supervisor::MAX_ADAPTER_SCALE;pub use supervisor::ModelState;pub use supervisor::ModelStatus;pub use supervisor::Reservation;pub use supervisor::Supervisor;pub use supervisor::SupervisorEvent;pub use supervisor::SupervisorOptions;
Modules§
- engine
- How each engine is launched and probed.
- error
- Errors are
weirdnet-agent’sRemoteError, so they cross infer/2 and node/1 unchanged. - host
- The model node’s inference side: a
weirdnet-agentInferHostover theSupervisor, serving raw infer/2 (assembled messages in, tokens out; cancel aborts the engine request). - link
- Link info for capability records (M7 phase 1): a model node’s private interfaces, so the planner can place swap groups on machines with a fast private link.
- mlx
- MLX-LM (
mlx_lm.server) on Apple silicon: installing a pinnedmlx-lm, and the proxy the supervisor puts in front of it. - models
/weirdnet-backends/models/1: the owner manages a model node’s model files overweirdnet-net: search the Hugging Face Hub, see which files fit the node, pull one (split GGUFs too) and serve it without a restart, list and remove what is on disk. LoRA adapters too:Pull::adapter_forpulls one for a served base model and adds it to that base;ModelsCommand::ServeAdapter,ModelsCommand::UnserveAdapterandModelsCommand::AdapterScaleadd a stored one to a base, take one off and change its scale while the base keeps running where the engine allows (seeSupervisor::add_adapter_live).- node
/weirdnet-backends/node/1: how inference nodes drive model nodes overweirdnet-net.- openai
- Engine request bodies (OpenAI
/v1/chat/completionsand/v1/completions) from infer/2 requests. - sse
- OpenAI-style server-sent events from an engine, decoded into
Chunks. - supervisor
- Starts, probes, drains and stops engine processes for one model node: swap groups, idle unload, crash detection with restart backoff, and readiness probes.