{"record":{"id":"d7340fb5c5204444","repo":"deepfakes/faceswap","slug":"arch-is-not-compatible-with-your-version-of-ker","errorCode":null,"errorMessage":"{arch}' is not compatible with your version of Keras. The minimum version required is {keras_min} whilst you have version {keras_ver} installed.","messagePattern":"(.+?)' is not compatible with your version of Keras\\. The minimum version required is (.+?) whilst you have version (.+?) installed\\.","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"plugins/train/model/phaze_a.py","lineNumber":336,"sourceCode":"        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\n        Returns\n        -------\n        :class:`keras.models.Model`\n            The generated model\n        \"\"\"\n        # Create sub-Models","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/plugins/train/model/phaze_a.py#L318-L354","documentation":"FaceswapError raised by Phaze-A._validate_encoder_architecture() when the chosen encoder architecture exists but your installed Keras version is below its keras_min requirement. Each entry in _MODEL_MAPPING declares a minimum Keras version; newer architectures often need newer Keras APIs. The error reports both the required minimum and your installed version.","triggerScenarios":"Selecting a modern encoder (e.g. a ViT or newer EfficientNet variant) while running an older Keras than its keras_min. get_keras_version() < model.keras_min at validation time.","commonSituations":"Pinned/downgraded Keras for another project, stale conda/venv environment, or Faceswap updated without refreshing its dependencies.","solutions":["Upgrade Keras in the Faceswap environment to at least the version named in the message (pip install -U keras)","Or switch enc_architecture to an older encoder whose keras_min fits your installed version","Preferably let Faceswap's own requirements/installer manage the dependency set to avoid mismatches"],"exampleFix":"# before\npip show keras   # e.g. 2.15, arch requires 3.0\n\n# after\npip install -U \"keras>=3.0\"\n# or choose an older arch in phaze_a_config.json:\n\"enc_architecture\": \"efficientnet_b0\"","handlingStrategy":"validation","validationCode":"from lib.utils import get_keras_version  # faceswap helper\nfrom plugins.train.model.phaze_a import _MODEL_MAPPING\narch = _MODEL_MAPPING[cfg.enc_architecture()]\nif get_keras_version() < arch.keras_min:\n    raise SystemExit(f\"Keras {arch.keras_min}+ required for {cfg.enc_architecture()}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install Faceswap via its own requirements so Keras stays in the supported range","Check keras version (python -c 'import keras; print(keras.__version__)') after any env change"],"tags":["faceswap","phaze-a","keras","version","environment"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}