{"record":{"id":"c09f54cba485648a","repo":"deepfakes/faceswap","slug":"unable-to-load-the-model-from-self-filename-t","errorCode":null,"errorMessage":"Unable to load the model from '{self.filename}'. This may be a temporary error but most likely means that your model has corrupted.\\nYou can try to load the model again but if the problem persists you should use the Restore Tool to restore your model from backup.\\nOriginal error: {str(err)}","messagePattern":"Unable to load the model from '(.+?)'\\. This may be a temporary error but most likely means that your model has corrupted\\.\\\\nYou can try to load the model again but if the problem persists you should use the Restore Tool to restore your model from backup\\.\\\\nOriginal error: (.+?)","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"critical","filePath":"plugins/train/model/_base/io.py","lineNumber":180,"sourceCode":"        Returns\n        -------\n        The saved model loaded from disk\n        \"\"\"\n        logger.debug(\"[IO] Loading model: %s\", self.filename)\n        if self._is_predict and not self.model_exists:\n            logger.error(\"Model could not be found in folder '%s'. Exiting\", self._model_dir)\n            sys.exit(1)\n\n        try:\n            model = k_models.load_model(self.filename, compile=False)\n        except RuntimeError as err:\n            if \"unable to get link info\" in str(err).lower():\n                msg = (f\"Unable to load the model from '{self.filename}'. This may be a \"\n                       \"temporary error but most likely means that your model has corrupted.\\n\"\n                       \"You can try to load the model again but if the problem persists you \"\n                       \"should use the Restore Tool to restore your model from backup.\\n\"\n                       f\"Original error: {str(err)}\")\n                raise FaceswapError(msg) from err\n            raise err\n        except KeyError as err:\n            if \"unable to open object\" in str(err).lower():\n                msg = (f\"Unable to load the model from '{self.filename}'. This may be a \"\n                       \"temporary error but most likely means that your model has corrupted.\\n\"\n                       \"You can try to load the model again but if the problem persists you \"\n                       \"should use the Restore Tool to restore your model from backup.\\n\"\n                       f\"Original error: {str(err)}\")\n                raise FaceswapError(msg) from err\n            if 'parameter name can\\\\\\'t contain \".\"' in str(err).lower():\n                PatchKerasConfig(self.filename)()\n                return self.load()\n            raise err\n        except TypeError as err:\n            if any(x in str(err) for x in (\"Could not locate class 'Conv2D'\",\n                                           \"Could not locate class 'DepthwiseConv2D'\")):\n                PatchKerasConfig(self.filename)()\n                return self.load()","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/plugins/train/model/_base/io.py#L162-L198","documentation":"Raised when keras.models.load_model raises a RuntimeError containing 'unable to get link info' while loading a saved Faceswap model file. Faceswap interprets this h5py/keras low-level failure as probable model-file corruption (or a transient filesystem hiccup) and wraps it in a FaceswapError pointing at the built-in Restore Tool.","triggerScenarios":"Loading a training session whose .h5/.keras state file is corrupt — interrupted save, disk-full during write, or copying the model folder while a save was in progress. The 'unable to get link info' text comes from HDF5 when internal object links are broken.","commonSituations":"Power loss / process kill during a model snapshot; running out of disk space mid-save; syncing/copying the model directory while training; filesystem-level corruption.","solutions":["Simply retry the load once — the message notes it may be transient.","Restore the model from a backup with the Faceswap Restore Tool (faceswap restore, or GUI Tools > Restore), which reverts to the last good snapshot.","Free up disk space and make sure the model folder is on a reliable filesystem; avoid touching it while training saves.","If no backup exists, training must be restarted from scratch."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"from lib.exceptions import FaceswapError\nfor attempt in range(2):\n    try:\n        io.load()\n        break\n    except FaceswapError as err:\n        if attempt == 0 and \"temporary error\" in str(err):\n            continue  # one retry for transient FS hiccup\n        if \"Restore Tool\" in str(err):\n            run_faceswap_restore_tool(model_dir)\n        raise","preventionTips":["Never kill training mid-snapshot; stop via the session's graceful shutdown (enter 'S'/'Terminate and Save' in the GUI/CLI).","Keep automatic backups/snapshots enabled so the Restore Tool always has a recent good state.","Don't sync or copy the model folder while training is writing."],"tags":["faceswap","model-io","keras","corruption","training"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}