deepfakes/faceswap · error · FaceswapError
No weights were successfully loaded from your weights file:
Error message
No weights were successfully loaded from your weights file: '{self._weights_file}'. Please check and try again. What it means
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).
Source
Thrown at plugins/train/model/_base/io.py:494
msg = f"Skipping layer {model_name} as not in "
msg += "current_model." if not sub_model else f"weights '{self._weights_file}.'"
logger.warning(msg)
continue
logger.info("Loading weights for layer '%s'", model_name)
skipped_ops = 0
loaded_ops = 0
for layer in sub_model.layers:
success = self._load_layer_weights(layer, sub_weights, model_name)
if success == 0:
skipped_ops += 1
elif success == 1:
loaded_ops += 1
del weights_models
if loaded_ops == 0:
raise FaceswapError(f"No weights were successfully loaded from your weights file: "
f"'{self._weights_file}'. Please check and try again.")
if skipped_ops > 0:
logger.warning("%s weight(s) were unable to be loaded for your model. This is most "
"likely because the weights you are trying to load were trained with "
"different settings than you have set for your current model.",
skipped_ops)
def _get_weights_model(self) -> list[k_models.Model]:
"""Obtain a list of all sub-models contained within the weights model.
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 differentView on GitHub (pinned to f530cb7508)
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.
Example fix
# before: weights from a different model plugin faceswap train ... -m mymodel -wm other_model_weights.keras # after: either use matching weights faceswap train ... -m mymodel -m same_arch_weights.keras # or train fresh without -wm
Defensive patterns
Strategy: validation
Validate before calling
# Before training, sanity-check that the weights model shares layer names with your model:
import keras.models as km
w = km.load_model(weights_file, compile=False)
my = km.load_model(state_file, compile=False)
shared = {l.name for l in w.layers} & {l.name for l in my.layers}
assert shared, "weights share no layers with this model; transfer will fail" Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Load weights selected, but the path '{weights_file}' does no
- Error loading weights file {self._weights_file}.
- You are attempting to load weights from a '{retval[0].name}'
- You have selected the mask type '{mask_type}' but at least o
- '{method}' is not a valid clipping method. Select from {list
AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15).
Data as JSON: /api/errors/9a42df79aef075a6.
Report an issue: GitHub.