deepfakes/faceswap · critical · FaceswapError
Unable to load the model from '{self.filename}'. This may be
Error message
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)} What it means
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.
Source
Thrown at plugins/train/model/_base/io.py:180
Returns
-------
The saved model loaded from disk
"""
logger.debug("[IO] Loading model: %s", self.filename)
if self._is_predict and not self.model_exists:
logger.error("Model could not be found in folder '%s'. Exiting", self._model_dir)
sys.exit(1)
try:
model = k_models.load_model(self.filename, compile=False)
except RuntimeError as err:
if "unable to get link info" in str(err).lower():
msg = (f"Unable to load the model from '{self.filename}'. This may be a "
"temporary error but most likely means that your model has corrupted.\n"
"You can try to load the model again but if the problem persists you "
"should use the Restore Tool to restore your model from backup.\n"
f"Original error: {str(err)}")
raise FaceswapError(msg) from err
raise err
except KeyError as err:
if "unable to open object" in str(err).lower():
msg = (f"Unable to load the model from '{self.filename}'. This may be a "
"temporary error but most likely means that your model has corrupted.\n"
"You can try to load the model again but if the problem persists you "
"should use the Restore Tool to restore your model from backup.\n"
f"Original error: {str(err)}")
raise FaceswapError(msg) from err
if 'parameter name can\\\'t contain "."' in str(err).lower():
PatchKerasConfig(self.filename)()
return self.load()
raise err
except TypeError as err:
if any(x in str(err) for x in ("Could not locate class 'Conv2D'",
"Could not locate class 'DepthwiseConv2D'")):
PatchKerasConfig(self.filename)()
return self.load()View on GitHub (pinned to f530cb7508)
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.
Defensive patterns
Strategy: retry
Try / catch
from lib.exceptions import FaceswapError
for attempt in range(2):
try:
io.load()
break
except FaceswapError as err:
if attempt == 0 and "temporary error" in str(err):
continue # one retry for transient FS hiccup
if "Restore Tool" in str(err):
run_faceswap_restore_tool(model_dir)
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- You have selected the mask type '{mask_type}' but at least o
- '{method}' is not a valid clipping method. Select from {list
- '{name}' is not a valid optimizer. Select from {list(_OPTIMI
- You do not have enough GPU memory available to train the sel
- A NaN was detected and you have NaN protection enabled. Trai
AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15).
Data as JSON: /api/errors/c09f54cba485648a.
Report an issue: GitHub.