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). It is not compiled for wasm32-unknown-unknown, where hosts fetch
weights themselves and hand them over with super::provide_weights.
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. - write_
atomically 🔒 - write_
cached 🔒 - Write
bytesinto the cache asfile, atomically: a temp file unique to this writer, then a rename over the final name.