{"record":{"id":"f0084b1da564d5b4","repo":"deepfakes/faceswap","slug":"config-error-output-size-must-be-one-of-128-256","errorCode":null,"errorMessage":"Config error: output_size must be one of: 128, 256, or 384.","messagePattern":"Config error: output_size must be one of: 128, 256, or 384\\.","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"plugins/train/model/dlight.py","lineNumber":47,"sourceCode":"    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.input_shape = (128, 128, 3)\n\n        self.features = {\"lowmem\": 0, \"fair\": 1, \"best\": 2}[cfg.features()]\n        self.encoder_filters = 64 if self.features > 0 else 48\n\n        bonum_fortunam = 128\n        self.encoder_dim = {0: 512 + bonum_fortunam,\n                            1: 1024 + bonum_fortunam,\n                            2: 1536 + bonum_fortunam}[self.features]\n        self.details = {\"fast\": 0, \"good\": 1}[cfg.details()]\n        try:\n            self.upscale_ratio = {128: 2,\n                                  256: 4,\n                                  384: 6}[cfg.output_size()]\n        except KeyError as err:\n            logger.error(\"Config error: output_size must be one of: 128, 256, or 384.\")\n            raise FaceswapError(\"Config error: output_size must be one of: \"\n                                \"128, 256, or 384.\") from err\n\n        logger.debug(\"output_size: %s, features: %s, encoder_filters: %s, encoder_dim: %s, \"\n                     \" details: %s, upscale_ratio: %s\", cfg.output_size(), self.features,\n                     self.encoder_filters, self.encoder_dim, self.details, self.upscale_ratio)\n\n    def build_model(self, inputs):\n        \"\"\" Build the Dlight Model. \"\"\"\n        encoder = self.encoder()\n        encoder_a = encoder(inputs[0])\n        encoder_b = encoder(inputs[1])\n\n        decoder_b = self.decoder_b if self.details > 0 else self.decoder_b_fast\n\n        outputs = self.decoder_a()(encoder_a) + decoder_b()(encoder_b)\n\n        autoencoder = KModel(inputs, outputs, name=self.model_name)\n        return autoencoder","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/plugins/train/model/dlight.py#L29-L65","documentation":"FaceswapError raised in the Dlight model plugin __init__ when cfg.output_size() is not one of the dictionary keys 128, 256, or 384. The KeyError from the dict lookup is caught, logged, and re-raised as FaceswapError. Dlight's upscale ratio is defined only for those three output sizes, so other sizes cannot be built.","triggerScenarios":"Starting training (or convert with Dlight) with output_size set to anything other than 128/256/384 in dlight config, e.g. 64 or 160. The dict {128:2, 256:4, 384:6}[cfg.output_size()] raises KeyError.","commonSituations":"User sets an arbitrary output size in the GUI/config assuming all sizes are supported, or copies a config from another plugin that permits different sizes.","solutions":["Edit the Dlight config (GUI or <model_dir>/dlight_config.json) and set output_size to 128, 256, or 384","Pick the size matching your training goals: 128 fast, 256 balanced, 384 highest detail","If you need another size, switch to a plugin that supports it (e.g. Phaze-A multiples of 16)"],"exampleFix":"# before (dlight_config.json)\n\"output_size\": 160\n\n# after\n\"output_size\": 256","handlingStrategy":"validation","validationCode":"output_size = 128  # from your config\nif output_size not in (128, 256, 384):\n    raise SystemExit(f\"Dlight output_size must be 128, 256 or 384, got {output_size}\")","typeGuard":"def is_valid_dlight_output_size(size: int) -> bool:\n    \"\"\"True if size is one of Dlight's supported output sizes.\"\"\"\n    return size in (128, 256, 384)","tryCatchPattern":null,"preventionTips":["Read the plugin's config hint before changing output_size","Remember each plugin has its own output size rules; re-validate after switching plugins"],"tags":["faceswap","dlight","config","training"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}