Expand description
Native weight download and on-disk cache (download feature).
Fetches a model’s weight files over HTTP, verifies their SHA-256, and stores
them under super::cache_dir. This is the “download on use” path for native
hosts (e.g. QSMxT). WASM hosts do not use this module — they fetch weights in
JavaScript and feed the bytes to super::onnx directly.
Enums§
- Download
Error - Error from resolving or downloading model weights.
Constants§
- MAX_
ATTEMPTS 🔒 - Max HTTP attempts for a single weight file (1 initial + 4 retries).
Functions§
- checksum_
ok 🔒 - ensure_
file - Ensure a single weight file is present locally, downloading it if needed, and
return its path. See
ensure_file_with_progress. - ensure_
file_ with_ progress - Like
ensure_file, but reports download progress viaon_progress(downloaded, total)(bytes).totalis the registry-declared size (WeightFile::bytes), falling back to the responseContent-Length. Not called on a cache hit. - ensure_
model - Ensure every weight file for a model is present, returning their paths in
ModelSpec::filesorder. - http_
get 🔒 - Fetch a URL with exponential-backoff retries, streaming the body and reporting
on_progress(downloaded, total)as it goes (totalfromexpected_total, else the responseContent-Length, else 0 = unknown). Progress resets to 0 at the start of each attempt (a retried download restarts from the beginning). - http_
get_ 🔒once - One HTTP GET, streamed in chunks. Returns
(message, retryable)on failure. - primary_
bytes - Read the primary (first) weight file of a model into memory. Convenience for
handing bytes straight to
super::onnx::OnnxModel::load. - sha256_
hex - Lowercase hex SHA-256 of a byte slice.