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

WeightRenaming

WeightRenaming​

class max.pipelines.lib.WeightRenaming(pattern, replacement)

source

Bases: object

Renames weights by regular expression substitution.

Replaces every match of pattern in a weight’s name, as re.sub() does, so replacement can refer to groups as \1 or \g<name>. A pattern matches anywhere in the name unless it is anchored.

Raises:

ValueError – If pattern is not a regular expression, uses look-around or a back-reference, or can match the empty string.

Parameters:

  • pattern (str)
  • replacement (str)

pattern​

pattern: str

source

The regular expression to replace.

prefix()​

classmethod prefix(prefix)

source

Returns the rule that puts every name under prefix.

A pipeline model appends it to an entry’s rules to place a module in a graph, as a speculative-decoding graph places its target under target..

Parameters:

prefix (str) – The text every name starts with afterwards.

Return type:

Self

replacement​

replacement: str

source

The text that replaces each match.