Expand description
Model-agnostic weight I/O — paths, formats, drain policy only.
Architecture checks and tensor renaming live in model crates (gguf_validate_arch,
register_gguf_tensor_resolver), not here.
use rlx_models_core::weights::{self, LoadOpts};
let (path, map) = weights::open_map_with(LoadOpts::map().prefer_q4_k_m(), "weights/")?;
let loaded = weights::open_with(LoadOpts::loader(), "model.gguf")?;Structs§
- Gguf
DirGuide - Gguf
Loader - Llama
Family Gguf Resolver - HF
model.layers.N.*↔ GGUFblk.N.*(Llama, Qwen3, Qwen35, …). - Load
Weights Options - Options for
load_weights_resolved— prefercrate::weights::LoadOptspresets at call sites. - Prefix
Strip Gguf Resolver - Strip common HF prefixes and match verbatim tensor names (architecture-agnostic fallback).
- Qwen35
Native Gguf Resolver - Qwen3.5 native
blk.N.*names; also accept HF aliases via the Llama mapper. - Registered
Format - One registered on-disk format (built-in or custom).
- Resolve
Weights Options - Options for
resolve_weights_file_with_options. - Weight
Format Registration - Describes one on-disk weight format.
- Weight
Map - Map of tensor name → (f32 data, shape).
Enums§
- Loaded
Weights - Result of resolving and opening weights.
- Weight
Drain Policy - How
WeightMap::drain_loader/WeightMap::from_weight_loaderhandle leftovers.
Traits§
- Gguf
Tensor Name Resolver - Resolve a builder-requested tensor name to the name stored in a GGUF file.
- Weight
Loader - Common interface every weight format must satisfy. Mirrors the
existing
WeightMapAPI so the safetensors impl is a one-line adapter.
Functions§
- default_
resolve_ opts - Default directory resolve: prefer
DEFAULT_GGUF_PREFER_SUBSTR. - format_
for_ extension - Extension → format id (last registration wins).
- gguf_
dir_ guide - Numbered
.gguflisting + resolve hints for a directory (CLI / errors). - gguf_
split_ siblings - Other parts of the same multi-file GGUF split in
path’s directory (sorted bysplit.no). - gguf_
validate_ arch - Ensure a GGUF file’s
general.architectureis inallowed(call from model runners, not the loader). - init
- Idempotent: ensure built-in GGUF tensor resolvers are registered (safe to call from
main). - list_
gguf_ files_ in_ dir - Sorted
.ggufpaths in a directory (non-recursive). - list_
registered_ formats - All registered formats (built-ins first, then custom registrations).
- load_
gguf_ file - Open a GGUF file, merging multi-part splits when all siblings are present in the directory.
- load_
weight_ map - Resolve a weights path, validate GGUF
general.architecturewhen applicable, drain to F32. - load_
weight_ map_ resolved - Convenience: resolve + drain to F32
WeightMap. - load_
weights_ resolved - Resolve a file or directory, enforce GGUF arch policy, open via registry, optionally drain.
- open
- Resolve + open (live
WeightLoader). - open_
map - Resolve + drain to F32
WeightMap. - open_
map_ with - Resolve + drain with options.
- open_
weight_ loader - Open a single file via the format registry.
- open_
with - Resolve + open with options.
- pick
- Resolve a file or weights directory to one on-disk path.
- pick_
default pickwithdefault_resolve_opts.- register_
gguf_ tensor_ resolver - Register a custom resolver (call before first GGUF load). Later registrations win among resolvers that match the same architecture.
- register_
weight_ format - Register a custom weight format (call before the first load). Later entries override built-ins when the same extension is registered twice.
- resolve_
weights_ file - Resolve
--weightsto a single file: pass-through for files, or pick one.gguf/model.safetensorsinside a directory. - resolve_
weights_ file_ with_ options - Resolve with optional GGUF file selection inside a directory.
Type Aliases§
- Load
Opts - Alias for
LoadWeightsOptions. - Pass
Through Gguf Resolver - Alias for
PrefixStripGgufResolver(older name). - Resolve
Opts - Alias for
ResolveWeightsOptions.