Skip to main content

Module models

Module models 

Source
Expand description

/weirdnet-backends/models/1: the owner manages a model node’s model files over weirdnet-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_for pulls one for a served base model and adds it to that base; ModelsCommand::ServeAdapter, ModelsCommand::UnserveAdapter and ModelsCommand::AdapterScale add a stored one to a base, take one off and change its scale while the base keeps running where the engine allows (see Supervisor::add_adapter_live).

Only the owner may use it: ModelsService takes an Authorize and runs nothing before it admits the caller. Pass weirdnet_agent::serve::RosterAuth for the owner’s linked devices (with require_roles to narrow it to devices holding a role the owner granted).

The Hugging Face token never travels: the node uses its own (ModelStore::from_env), and nothing in this protocol carries one.

Models made elsewhere are uploaded (ModelsCommand::Upload, see upload for the stream), copied node to node (PullSource::Peer over ModelsCommand::Fetch), and writes follow the service’s WritePolicy. ModelsCommand::List carries each entry’s provenance; ModelsCommand::Disk reports free space, limits and usage.

Each stream carries one ModelsRequest (CBOR, with the caller’s certificate) and its answers (ModelsReply): one answer, or for ModelsCommand::Pull a stream of ModelsReply::Progress then ModelsReply::Pulled. Closing the stream cancels a pull; the partial file is kept, so pulling again resumes it.

Re-exports§

pub use placed::OnPlaced;
pub use placed::Placed;
pub use placed::PlacedVia;
pub use upload::CHUNK;
pub use upload::DiskReport;
pub use upload::KeepFree;
pub use upload::PullSource;
pub use upload::Upload;
pub use upload::UploadFrame;
pub use upload::WritePolicy;
pub use upload::refusal;
pub use upload::refusal_reason;

Modules§

placed
Placement hooks: the app hears about every entry a ModelsService puts in its store.
upload
models/1 uploads: local files sent to a node in chunks, resumable, checked before anything is placed; ModelsCommand::Fetch so a node can pull an upload or a stored entry from another node (PullSource::Peer); ModelsCommand::Disk; and the WritePolicy for all writes.

Structs§

ModelsClient
The owner’s side of models/1, over a Dialer (weirdnet_agent::pool::NetDialer on Weirdnet).
ModelsRequest
What a client sends: its certificate and one command.
ModelsServer
Serves a ModelsService on a weirdnet-net node. Dropping it stops serving.
ModelsService
A model node’s models/1 side. Transport-neutral (ModelsService::serve takes a channel); ModelsServer runs it on a weirdnet-net node. Its methods also work in-process (a local CLI on the node itself).
Pull
What to pull.
Pulled
A finished pull.
RepoFits
A repo’s models against this node.
StoredEntry
A stored model or LoRA adapter and, when the supervisor serves it, its state.

Enums§

ModelsCommand
A models/1 request. Nodes before 0.4.1 refuse the adapter commands.
ModelsReply
What a models/1 node answers.

Constants§

MODELS_PROTOCOL
The protocol id.