deepfakes/faceswap · error · FaceswapError

Phaze-A output shape must be a multiple of 16

Error message

Phaze-A output shape must be a multiple of 16

What it means

FaceswapError raised in the Phaze-A model plugin __init__ when cfg.output_size() % 16 != 0. Phaze-A's encoders and pooling architecture require input/output dimensions divisible by 16. The check runs before any architecture validation, so it fails immediately at plugin construction.

Source

Thrown at plugins/train/model/phaze_a.py:179

class Model(ModelBase):
    """ Phaze-A Faceswap Model.

    An highly adaptable and configurable model by torzDF

    Parameters
    ----------513
    args: varies
        The default command line arguments passed in from :class:`~scripts.train.Train` or
        :class:`~scripts.train.Convert`
    kwargs: varies
        The default keyword arguments passed in from :class:`~scripts.train.Train` or
        :class:`~scripts.train.Convert`
    """
    def __init__(self, *args, **kwargs) -> None:
        super().__init__(*args, **kwargs)
        if cfg.output_size() % 16 != 0:
            raise FaceswapError("Phaze-A output shape must be a multiple of 16")

        self._validate_encoder_architecture()

        self.input_shape: tuple[int, int, int] = self._get_input_shape()
        self.color_order = _MODEL_MAPPING[cfg.enc_architecture()].color_order

    @property
    def freeze_layers(self) -> list[str]:
        """ list[str] : Valid layers to freeze based on configured options """
        return self._select_real_layers(cfg.freeze_layers())

    @property
    def load_layers(self) -> list[str]:
        """ list[str] : Valid layers to load based on configured options """
        return self._select_real_layers(cfg.load_layers())

    def build(self) -> None:
        """ Build the model and assign to :attr:`model`.

View on GitHub (pinned to f530cb7508)

Solutions

  1. Set output_size in the Phaze-A config to a multiple of 16 (e.g. 64, 128, 256, 384)
  2. Match the size to your input data resolution for best results
  3. Remember changing output_size on an existing model restarts training from scratch

Example fix

# before (phaze_a_config.json)
"output_size": 100

# after
"output_size": 128
Defensive patterns

Strategy: validation

Validate before calling

output_size = 128  # from your config
if output_size % 16 != 0:
    raise SystemExit(f"Phaze-A output_size must be a multiple of 16, got {output_size}")

Type guard

def is_valid_phaze_output_size(size: int) -> bool:
    """True if size is divisible by 16 (Phaze-A requirement)."""
    return size > 0 and size % 16 == 0

Prevention

When it happens

Trigger: Starting train or convert with Phaze-A and an output_size like 100 or 130 in phaze_a config. The modulo check trips on any non-multiple of 16.

Common situations: User enters a custom output size in the GUI assuming any value works, or ports a config from a plugin with different divisibility rules.

Related errors


AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15). Data as JSON: /api/errors/6c673b137a3e1e3b. Report an issue: GitHub.