quant

package
v0.32.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package quant holds the quantization format facts shared by the model importer, the runtime loader, and `ollama show`. It deliberately has no dependency on the MLX C library, so any package can use it without pulling in cgo — which is what keeps these facts from drifting between separate hand-maintained copies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bits

func Bits(quantType string) int

Bits returns the bit width of a recognized quantization type, or 0 if the type is empty or unrecognized. Unlike Params it applies no fallback, so callers that size or display tensors never act on an unknown type.

func Canonical

func Canonical(quantType string) string

Canonical returns the canonical name for a quantization type, resolving aliases (for example "FP8" and "Q8" both map to "int8"). It returns "" for the empty string and for any type it does not recognize.

func PackFactor

func PackFactor(quantType string) int

PackFactor returns how many quantized values are packed into one 32-bit word, or 0 for an empty or unrecognized type. MLX stores quantized weights packed into U32 words, so a tensor's logical last dimension is its stored last dimension times this factor.

func Params

func Params(quantType string) (groupSize, bits int, mode string)

Params returns the default group size, bit width, and mode for a quantization type. The empty string returns zeros. An unrecognized non-empty type falls back to 8-bit affine, matching the runtime loader's historical leniency toward unexpected metadata.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL