{"record":{"id":"9a42df79aef075a6","repo":"deepfakes/faceswap","slug":"no-weights-were-successfully-loaded-from-your-weig","errorCode":null,"errorMessage":"No weights were successfully loaded from your weights file: '{self._weights_file}'. Please check and try again.","messagePattern":"No weights were successfully loaded from your weights file: '(.+?)'\\. Please check and try again\\.","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"plugins/train/model/_base/io.py","lineNumber":494,"sourceCode":"                msg = f\"Skipping layer {model_name} as not in \"\n                msg += \"current_model.\" if not sub_model else f\"weights '{self._weights_file}.'\"\n                logger.warning(msg)\n                continue\n\n            logger.info(\"Loading weights for layer '%s'\", model_name)\n            skipped_ops = 0\n            loaded_ops = 0\n            for layer in sub_model.layers:\n                success = self._load_layer_weights(layer, sub_weights, model_name)\n                if success == 0:\n                    skipped_ops += 1\n                elif success == 1:\n                    loaded_ops += 1\n\n        del weights_models\n\n        if loaded_ops == 0:\n            raise FaceswapError(f\"No weights were successfully loaded from your weights file: \"\n                                f\"'{self._weights_file}'. Please check and try again.\")\n        if skipped_ops > 0:\n            logger.warning(\"%s weight(s) were unable to be loaded for your model. This is most \"\n                           \"likely because the weights you are trying to load were trained with \"\n                           \"different settings than you have set for your current model.\",\n                           skipped_ops)\n\n    def _get_weights_model(self) -> list[k_models.Model]:\n        \"\"\"Obtain a list of all sub-models contained within the weights model.\n\n        Returns\n        -------\n        List of all models contained within the .keras file\n\n        Raises\n        ------\n        FaceswapError\n            In the event of a failure to load the weights, or the weights belonging to a different","sourceCodeStart":476,"sourceCodeEnd":512,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/plugins/train/model/_base/io.py#L476-L512","documentation":"Raised after the weight-transfer pass when loaded_ops == 0: the .keras weights file opened successfully, but not a single layer of the current model matched/successfully received weights from it. Faceswap treats total transfer failure as an error (partial mismatches only produce a warning with skipped_ops).","triggerScenarios":"Loading a weights file whose architecture shares no layers with the current model — e.g. warm-starting from a different model plugin or a model trained with incompatible input size/settings, so every _load_layer_weights call returns 0.","commonSituations":"Trying to transfer weights between different model types; input dimensions or plugin settings changed so layer names/shapes never match; using a weights file saved by a much older version.","solutions":["Confirm the weights file was saved from the same model plugin and settings you are training now.","If you changed input size or other architecture-affecting settings, revert them to match the weights, or drop the weights file.","Check the log for the skipped-layers warning to see which layers failed and why (shape mismatch vs name mismatch).","If intentional (training from scratch), remove the load-weights option."],"exampleFix":"# before: weights from a different model plugin\nfaceswap train ... -m mymodel -wm other_model_weights.keras\n\n# after: either use matching weights\nfaceswap train ... -m mymodel -m same_arch_weights.keras\n# or train fresh without -wm","handlingStrategy":"validation","validationCode":"# Before training, sanity-check that the weights model shares layer names with your model:\nimport keras.models as km\nw = km.load_model(weights_file, compile=False)\nmy = km.load_model(state_file, compile=False)\nshared = {l.name for l in w.layers} & {l.name for l in my.layers}\nassert shared, \"weights share no layers with this model; transfer will fail\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only warm-start from weights saved by the same plugin and architecture-affecting settings (input size, etc.).","Read the skipped-layers warning after enabling load-weights; zero loaded layers means the setup is wrong."],"tags":["faceswap","weights","transfer-learning","training"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}