deepfakes/faceswap · error · FaceswapError
You have requested to train with the
Error message
You have requested to train with the '{self.name}' plugin, but a model file for the '{multiple_models[0]}' plugin already exists in the folder '{self.io.model_dir}'.\nPlease select a different model folder. What it means
FaceswapError raised by ModelBase._check_multiple_models() when training is requested with one plugin (e.g. 'original') but the model folder already contains a state/model file belonging to a different single plugin. Faceswap state files are plugin-specific and incompatible across model architectures, so it refuses to mix them. This is a guard against silently corrupting an existing model.
Solutions
- Create a new, empty model folder and pass it with -m so the new plugin starts fresh
- Or set -t to the plugin named in the error message (multiple_models[0]) to continue training the existing model
- Or move the existing model files out of the folder if the folder is meant to be reused
Example fix
# before python faceswap.py train -t original -m /models/shared # error: folder holds 'dlight' model # after python faceswap.py train -t original -m /models/original_new # or continue the existing model: python faceswap.py train -t dlight -m /models/shared
Defensive patterns
Strategy: validation
Validate before calling
import os, glob
plugin = "original" # the trainer you will launch
files = glob.glob(os.path.join(model_dir, "*_state.*")) + glob.glob(os.path.join(model_dir, "*.h5"))
foreign = [f for f in files if os.path.basename(f).split("_")[0] not in (plugin,)]
if foreign:
raise SystemExit(f"Model folder holds foreign plugin files: {foreign}") Try / catch
from lib.exceptions import FaceswapError
try:
trainer = Trainer(model_dir, args)
except FaceswapError as err:
if "plugin already exists" in str(err):
print("Pick a fresh model folder or the matching -t plugin")
raise Prevention
- Use one model folder per plugin/experiment and name folders after the plugin
- Check folder contents (ls) before switching trainers
When it happens
Trigger: Passing -m/--model-dir pointing at a folder that holds e.g. dlight_state.h5 while launching train.py with -t original (or any mismatched trainer plugin). Triggered on every training start that performs the model-folder consistency check.
Common situations: Reusing the same folder for a new experiment with a different model plugin, downloading someone else's model and training with the wrong plugin name, or a typo in the -t trainer argument.
Related errors
- Config error: output_size must be one of: 128, 256, or 384.
- 'Learn Mask' has been selected but you have not chosen a…
- Phaze-A output shape must be a multiple of 16
- There are multiple plugin types
- A NaN was detected and you have NaN protection enabled…
AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15).
Data as JSON: /api/errors/0ade7761d8b81424.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/train/model/_base/model.py:188
FaceswapError
If multiple model files, or models for a different plugin from that requested exists
within the model folder
"""
multiple_models = self._io.multiple_models_in_folder
if multiple_models is None:
logger.debug("Contents of model folder are valid")
return
if len(multiple_models) == 1:
msg = (f"You have requested to train with the '{self.name}' plugin, but a model file "
f"for the '{multiple_models[0]}' plugin already exists in the folder "
f"'{self.io.model_dir}'.\nPlease select a different model folder.")
else:
p_types = "', '".join(multiple_models)
msg = (f"There are multiple plugin types ('{p_types}') stored in the model folder '"
f"{self.io.model_dir}'. This is not supported.\nPlease split the model files "
"into their own folders before proceeding")
raise FaceswapError(msg)
def build(self) -> None:
"""Build the model and assign to :attr:`model`.
Within the defined strategy scope, either builds the model from scratch or loads an
existing model if one exists.
If running inference, then the model is built only for the required side to perform the
swap function, otherwise the model is then compiled with the optimizer and chosen
loss function(s).
Finally, a model summary is outputted to the logger at verbose level.
"""
is_summary = hasattr(self._args, "summary") and self._args.summary
if self._io.model_exists:
model = self.io.load()
if self._is_predict:
inference = Inference(model, self._args.swap_model)View on GitHub (pinned to f530cb7508)