{"record":{"id":"65980c8d6b6c7080","repo":"deepfakes/faceswap","slug":"arch-is-not-a-valid-choice-for-encoder-archite","errorCode":null,"errorMessage":"'{arch}' is not a valid choice for encoder architecture. Choose one of {list(_MODEL_MAPPING.keys())}.","messagePattern":"'(.+?)' is not a valid choice for encoder architecture\\. Choose one of (.+?)\\.","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"plugins/train/model/phaze_a.py","lineNumber":330,"sourceCode":"                           \"Adjusting input size from %spx to %spx\",\n                           arch, default_size, size, default_size)\n            retval = (default_size, default_size, 3)\n        else:\n            retval = (size, size, 3)\n\n        logger.debug(\"Encoder input set to: %s\", retval)\n        return retval\n\n    def _validate_encoder_architecture(self) -> None:\n        \"\"\" Validate that the requested architecture is a valid choice for the running system\n        configuration.\n\n        If the selection is not valid, an error is logged and system exits.\n        \"\"\"\n        arch = cfg.enc_architecture()\n        model = _MODEL_MAPPING.get(arch)\n        if not model:\n            raise FaceswapError(f\"'{arch}' is not a valid choice for encoder architecture. Choose \"\n                                f\"one of {list(_MODEL_MAPPING.keys())}.\")\n\n        keras_ver = get_keras_version()\n        keras_min = model.keras_min\n        if keras_ver < keras_min:\n            raise FaceswapError(f\"{arch}' is not compatible with your version of Keras. The \"\n                                f\"minimum version required is {keras_min} whilst you have version \"\n                                f\"{keras_ver} installed.\")\n\n    def build_model(self, inputs: list[KerasTensor]) -> keras.models.Model:\n        \"\"\" Create the model's structure.\n\n        Parameters\n        ----------\n        inputs: list[:class:`keras.KerasTensor`]\n            A list of input tensors for the model. This will be a list of 2 tensors of\n            shape :attr:`input_shape`, the first for side \"a\", the second for side \"b\".\n","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/plugins/train/model/phaze_a.py#L312-L348","documentation":"FaceswapError raised by Phaze-A._validate_encoder_architecture() when cfg.enc_architecture() is not a key in _MODEL_MAPPING. The mapping is the authoritative list of encoder architectures compiled into your Faceswap version; unknown names are rejected before the model is built. The error lists all valid keys.","triggerScenarios":"Training Phaze-A with enc_architecture misspelled or from a different Faceswap version (e.g. 'effnet_v2_l' vs 'efficientnet_v2_l', or an arch removed/added in another release). _MODEL_MAPPING.get(arch) returns None.","commonSituations":"Hand-editing the config file, following an outdated tutorial, or moving a config between Faceswap versions whose architecture lists differ.","solutions":["Read the valid keys from the error message (list(_MODEL_MAPPING.keys())) and pick one","Fix typos/spelling of enc_architecture in phaze_a config to exactly match a listed key","Update Faceswap if the architecture you want exists in a newer release"],"exampleFix":"# before (phaze_a_config.json)\n\"enc_architecture\": \"effnet_v2_l\"\n\n# after\n\"enc_architecture\": \"efficientnet_v2_l\"","handlingStrategy":"validation","validationCode":"from plugins.train.model.phaze_a import _MODEL_MAPPING\narch = \"efficientnet_v2_l\"  # from your config\nif arch not in _MODEL_MAPPING:\n    raise SystemExit(f\"Unknown enc_architecture {arch!r}; valid: {sorted(_MODEL_MAPPING)}\")","typeGuard":"def is_valid_phaze_architecture(arch: str) -> bool:\n    \"\"\"True if arch exists in this Faceswap build's Phaze-A mapping.\"\"\"\n    from plugins.train.model.phaze_a import _MODEL_MAPPING\n    return arch in _MODEL_MAPPING","tryCatchPattern":null,"preventionTips":["Copy architecture names verbatim from the GUI dropdown or the error's valid list","Re-validate configs after upgrading Faceswap (architecture lists change between versions)"],"tags":["faceswap","phaze-a","config","encoder"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}