invoke-ai/InvokeAI · error · NotImplementedError

PixDiT_T2I context parallel is not implemented for the encod

Error message

PixDiT_T2I context parallel is not implemented for the encoder-decoder path. Build with enable_ed=False to use CP.

What it means

Context parallelism (CP, sharding sequence across GPUs) is only implemented for the non-ED path of PixDiT_T2I. enable_context_parallel refuses to enable CP on a network built with use_ed=True by raising NotImplementedError, because silently running CP on the encoder-decoder path would produce wrong results. The guard exists so misconfiguration fails loudly at setup rather than corrupting outputs.

Source

Thrown at invokeai/backend/pid/_src/networks/pixeldit_official.py:1354

        # Context-parallel state — set by `enable_context_parallel`. The base
        # class does not split tokens itself; subclasses (e.g. PidNet)
        # are responsible for splitting along L in `forward` and gathering
        # before the final fold. This attribute is propagated to every patch
        # block (joint MMDiT attention) and pixel block (RotaryAttention).
        self._cp_group: Optional[ProcessGroup] = None
        self._is_context_parallel_enabled: bool = False

    @property
    def is_context_parallel_enabled(self) -> bool:
        return self._is_context_parallel_enabled

    def enable_context_parallel(self, cp_group: ProcessGroup):
        # CP for the ED (encoder-decoder) path is not implemented; refuse to
        # enable CP if the network was built with use_ed=True so we don't
        # silently produce wrong results.
        if self.use_ed:
            raise NotImplementedError(
                "PixDiT_T2I context parallel is not implemented for the encoder-decoder path. "
                "Build with enable_ed=False to use CP."
            )
        for block in self.patch_blocks:
            block.set_context_parallel_group(cp_group)
        for block in self.pixel_blocks:
            block.set_context_parallel_group(cp_group)
        self._cp_group = cp_group
        self._is_context_parallel_enabled = True

    def disable_context_parallel(self):
        for block in self.patch_blocks:
            block.set_context_parallel_group(None)
        for block in self.pixel_blocks:
            block.set_context_parallel_group(None)
        self._cp_group = None
        self._is_context_parallel_enabled = False

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Rebuild the model with enable_ed=False if CP is required
  2. Or run the ED-path model without context parallelism (single-process / plain DDP)
  3. Request/implement CP support for the ED path upstream

Example fix

// before
net = build_model(enable_ed=True)
net.enable_context_parallel(cp_group)
// after
net = build_model(enable_ed=False)  # CP-compatible path
net.enable_context_parallel(cp_group)
Defensive patterns

Strategy: validation

Validate before calling

if getattr(net, "use_ed", False):
    raise RuntimeError("CP requires enable_ed=False")

Try / catch

try:
    net.enable_context_parallel(cp_group)
except NotImplementedError:
    logger.warning("Skipping CP: ED path enabled")

Prevention

When it happens

Trigger: Calling net.enable_context_parallel(cp_group) (via _maybe_enable_cp_on_nets) on a PixDiT_T2I instantiated with enable_ed=True.

Common situations: Multi-GPU launch scripts that always enable CP, combined with a config that enables the ED super-resolution path; a change of backbone config without updating the parallelism setup.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/cf637d119e9aaadd. Report an issue: GitHub.