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 function

split_layers

split_layers()​

max.pipelines.lib.pipeline_parallel.split_layers(spec, num_stages, sizes=None)

source

Returns each pipeline stage’s decoder layer count.

Parameters:

  • spec (PartitionSpec) – Where the decoder may be cut.
  • num_stages (int) – The number of pipeline stages.
  • sizes (list[int] | None) – Layer counts to validate. When None, the split closest to an even one, with the remainder on the earliest stages, whose cuts the spec allows.

Raises:

ValueError – If num_stages is not positive, sizes is invalid, or no allowed cuts leave every stage a layer.

Return type:

list[int]