Skip to main content

Crate rlx_pkg

Crate rlx_pkg 

Source
Expand description

RLX package format (.rlxp) — flat mmap (default), ZIP, or directory.

§Overview

PieceRole
PackageOpen flat / ZIP / dir; mmap hot weights; inflate warm/cold
write_packageEmit a pack from MIR graph + PackedWeight rows
WriteOptions::include_graphOptional executable MIR (default on); weight-only when false
StorageTierHot (mmap) / warm (zstd_blocks) / cold (zstd)

Spec: docs/rlxp.md.

Bake exports via package_from_bake / rlx-bake --format rlxp. ONNX import with an executable graph lives on rlx-bake (--features onnx).

§Features

Structs§

AutoTierOptions
Options for apply_auto_tier.
BakeWeight
Minimal weight row matching bake’s table (avoids depending on rlx-bake).
DdufImportOptions
Options for dduf_to_rlxp.
DistRef
Optional distribution section.
ExpertPlacement
Expert-parallel placement for one expert id.
FlatHeader
Fixed header before the TOC (24 bytes).
FlatToc
Table of contents after the fixed header.
GgufImportOptions
Options for gguf_to_rlxp.
GraphRef
Graph member reference inside the pack.
Manifest
Root package manifest (rlx.json).
MlxImportOptions
Options for mlx_to_rlxp.
NemoImportOptions
Options for nemo_to_rlxp.
Package
Opened RLX package.
PackedWeight
One weight to pack (from bake or another producer).
Placement
Distribution placement metadata.
PtImportOptions
Options for pt_to_rlxp.
SidecarRef
Named sidecar blob.
TensorShard
How one tensor is sharded across ranks.
VerifyReport
WeightEntry
One weight tensor in the package catalog.
WeightsIndex
Weight catalog file.
WeightsRef
Weights catalog pointer.
WriteOptions
Options for write_package.

Enums§

Codec
On-disk encoding of a blob’s payload bytes.
ContainerKind
On-disk container kind.
MaterializeMode
Which weight tiers to bind into graph Constants on Package::graph.
MemberSource
Where package members are served from.
StorageTier
Access class for a blob inside a flat package.

Constants§

COMPAT_VERSION
Minimum loader compat_version this crate supports.
DEFAULT_WARM_BLOCK
Default uncompressed block size for warm zstd_blocks (1 MiB).
FLAG_BINCODE_TOC
Flag bit: TOC is bincode rather than JSON.
FLAG_HYBRID
Flag bit: package uses hybrid hot/warm/cold codecs.
FLAT_CONTAINER_VERSION
Flat container format version. v2 = hybrid tiers; v1 still readable.
FLAT_MAGIC
Magic for the flat package (RLXPFLAT).
FORMAT_NAME
Package format identifier ("rlxp").
FORMAT_VERSION
Current structural schema version.
SEAL_MAGIC
Magic prefix for sealed blobs.

Functions§

apply_auto_tier
Mutate weights tiers in place using heuristics / allow-lists.
checksum_hex
xxh3-64 hex checksum of raw (uncompressed) bytes.
dduf_to_rlxp
Convert model.dduf → .rlxp (weights + optional stub graph).
decode_zstd_block_at
Decode one warm block by index without inflating the whole tensor.
decode_zstd_blocks
Decode a warm ZBLK blob to owned raw bytes (sequential).
decode_zstd_blocks_parallel
Decode warm blocks in parallel via rayon (better for large tensors).
dtype_for_weight_scheme
Map RLXP scheme strings to a host bind dtype for set_param_typed.
encode_zstd_blocks
Encode a warm blob: header + per-block zstd frames.
gguf_to_rlxp
Convert model.gguf → .rlxp (weights + optional stub graph).
graph_with_stripped_weights
Strip named weight constant payloads from a graph clone (disk size win).
infer_container
Infer container from path / explicit override.
infer_zip_from_path
Back-compat alias: true → Zip, false → Dir; None uses path inference (.rlxp → Flat).
is_flat_magic
is_sealed
True if bytes begin with the seal magic.
mlx_to_rlxp
Convert an MLX weight path (dir / .safetensors / .npz / .npy) → .rlxp.
nemo_to_rlxp
Convert model.nemo → .rlxp (f32 weights + config / tokenizer sidecars).
package_from_bake
Write a package from a baked graph and weight table.
pt_to_rlxp
Convert a PyTorch checkpoint → .rlxp (dense f32 weights).
seal_bytes
unseal_bytes
verify_package
Verify every tensor (and optional sidecars) against TOC checksums.
write_package
Write a package to out (path inferred as flat / ZIP / dir unless WriteOptions::container is set).
write_package_dir
Write an unpacked directory package.
write_package_flat
Write the flat mmap package (default .rlxp).
write_package_zip
Write a ZIP64 STORE archive (inspectable; larger/slower than flat).