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

Bitcast

Bitcast​

class max.pipelines.lib.Bitcast(pattern, src, dst)

source

Bases: object

Reinterprets the bytes of matching weights as another dtype.

Applies only to weights stored as src, such as block scales that a checkpoint stores as raw uint8 bytes. The result is a view of the same memory, so the shape and the bytes are unchanged.

Raises:

ValueError – If pattern is not a regular expression or uses look-around or a back-reference, or src and dst differ in width.

Parameters:

dst​

dst: DType

source

The dtype the weight’s bytes are reinterpreted as.

pattern​

pattern: str

source

The regular expression a weight’s name must match.

src​

src: DType

source

The dtype a weight must be stored as.