{"record":{"id":"6c673b137a3e1e3b","repo":"deepfakes/faceswap","slug":"phaze-a-output-shape-must-be-a-multiple-of-16","errorCode":null,"errorMessage":"Phaze-A output shape must be a multiple of 16","messagePattern":"Phaze-A output shape must be a multiple of 16","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"plugins/train/model/phaze_a.py","lineNumber":179,"sourceCode":"\nclass Model(ModelBase):\n    \"\"\" Phaze-A Faceswap Model.\n\n    An highly adaptable and configurable model by torzDF\n\n    Parameters\n    ----------513\n    args: varies\n        The default command line arguments passed in from :class:`~scripts.train.Train` or\n        :class:`~scripts.train.Convert`\n    kwargs: varies\n        The default keyword arguments passed in from :class:`~scripts.train.Train` or\n        :class:`~scripts.train.Convert`\n    \"\"\"\n    def __init__(self, *args, **kwargs) -> None:\n        super().__init__(*args, **kwargs)\n        if cfg.output_size() % 16 != 0:\n            raise FaceswapError(\"Phaze-A output shape must be a multiple of 16\")\n\n        self._validate_encoder_architecture()\n\n        self.input_shape: tuple[int, int, int] = self._get_input_shape()\n        self.color_order = _MODEL_MAPPING[cfg.enc_architecture()].color_order\n\n    @property\n    def freeze_layers(self) -> list[str]:\n        \"\"\" list[str] : Valid layers to freeze based on configured options \"\"\"\n        return self._select_real_layers(cfg.freeze_layers())\n\n    @property\n    def load_layers(self) -> list[str]:\n        \"\"\" list[str] : Valid layers to load based on configured options \"\"\"\n        return self._select_real_layers(cfg.load_layers())\n\n    def build(self) -> None:\n        \"\"\" Build the model and assign to :attr:`model`.","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/plugins/train/model/phaze_a.py#L161-L197","documentation":"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.","triggerScenarios":"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.","commonSituations":"User enters a custom output size in the GUI assuming any value works, or ports a config from a plugin with different divisibility rules.","solutions":["Set output_size in the Phaze-A config to a multiple of 16 (e.g. 64, 128, 256, 384)","Match the size to your input data resolution for best results","Remember changing output_size on an existing model restarts training from scratch"],"exampleFix":"# before (phaze_a_config.json)\n\"output_size\": 100\n\n# after\n\"output_size\": 128","handlingStrategy":"validation","validationCode":"output_size = 128  # from your config\nif output_size % 16 != 0:\n    raise SystemExit(f\"Phaze-A output_size must be a multiple of 16, got {output_size}\")","typeGuard":"def is_valid_phaze_output_size(size: int) -> bool:\n    \"\"\"True if size is divisible by 16 (Phaze-A requirement).\"\"\"\n    return size > 0 and size % 16 == 0","tryCatchPattern":null,"preventionTips":["Default to common sizes (64/128/256/384) which satisfy all plugins","Validate config diffs before starting a long training run"],"tags":["faceswap","phaze-a","config","training"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}