IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python class

WeightSource

WeightSource​

class max.nn.WeightSource(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

source

Bases: Enum

Where a quantized weight’s bytes come from.

Orthogonal to QuantFormat. The format says what a weight is once quantized – its grid, scales and byte layout. The source says how it got that way, which decides only what the checkpoint holds and who does the quantizing.

Keeping them apart matters because they are read by different code for different reasons. A kernel asks about the format; a weight loader asks about the source.

CHECKPOINT​

CHECKPOINT = 'checkpoint'

source

Pre-quantized on disk: the checkpoint holds packed data and scales.

QUANTIZE​

QUANTIZE = 'quantize'

source

Native precision on disk, quantized on the fly at first use.