deepfakes/faceswap · error · FaceswapError
You are attempting to load weights from a '{retval[0].name}'
Error message
You are attempting to load weights from a '{retval[0].name}' model into a '{self._name}' model. This is not supported. What it means
Raised in _get_weights_model when the weights file's first sub-model name does not equal the current model plugin's name (self._name). Faceswap only supports warm-starting within the same architecture, and uses the sub-model name as the identity check, so cross-model weight loading is refused before any layers are touched.
Source
Thrown at plugins/train/model/_base/io.py:522
Returns
-------
List of all models contained within the .keras file
Raises
------
FaceswapError
In the event of a failure to load the weights, or the weights belonging to a different
model
"""
retval = get_all_sub_models(k_models.load_model( # pyright:ignore[reportArgumentType]
self._weights_file,
compile=False))
if not retval:
raise FaceswapError(f"Error loading weights file {self._weights_file}.")
if retval[0].name != self._name:
raise FaceswapError(f"You are attempting to load weights from a '{retval[0].name}' "
f"model into a '{self._name}' model. This is not supported.")
return retval
def _load_layer_weights(self,
layer: layers.Layer,
sub_weights: layers.Layer,
model_name: str) -> T.Literal[-1, 0, 1]:
"""Load the weights for a single layer.
Parameters
----------
layer
The layer to set the weights for
sub_weights
The list of layers in the weights model to load weights from
model_name
The name of the current sub-model that is having it's weights loaded
View on GitHub (pinned to f530cb7508)
Solutions
- Use weights saved from the same model plugin as the one being trained.
- If the architecture changed deliberately, start fresh without load-weights.
- Verify which model plugin the weights came from (the error prints both names) and align your -m model selection with it.
Example fix
# before faceswap train -m original_model -wm dfl_sae_weights.keras # after faceswap train -m original_model -wm original_weights.keras # same plugin
Defensive patterns
Strategy: validation
Validate before calling
import keras.models as km
subs = get_all_sub_models(km.load_model(weights_file, compile=False))
assert subs[0].name == my_model_name, f"{subs[0].name} weights cannot load into {my_model_name}" Prevention
- Warm-start only within the same model plugin; cross-architecture transfer is unsupported by design.
- Name/organize weights files by the plugin that produced them.
When it happens
Trigger: Selecting load-weights with a file saved from a different model plugin (e.g. 'original' weights into a 'dfl-sae'/'realface' session) — retval[0].name differs from self._name.
Common situations: Copying a weights command from a tutorial built around another model; renaming the model plugin folder while keeping old weights; experimenting with cross-architecture transfer, which Faceswap does not support.
Related errors
- No weights were successfully loaded from your weights file:
- Error loading weights file {self._weights_file}.
- Load weights selected, but the path '{weights_file}' does no
- Landmark based masks cannot be created for {self._landmark_t
- There is a mismatch between the number of frames found in th
AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15).
Data as JSON: /api/errors/ca21c14e6684dbfa.
Report an issue: GitHub.