deepfakes/faceswap · error · FaceswapError
Predicted Mask selected, but the model was not trained with
Error message
Predicted Mask selected, but the model was not trained with a mask and no masks are stored in the Alignments File.\nYou should generate the required masks with the Mask Tool or set the Mask Type to `none`.
What it means
FaceswapError raised in Convert._check_output_args when -mask_type predicted is chosen, the model was not trained with a mask (predictor.has_predicted_mask is False), and no mask type in the alignments file fully covers all faces (available_masks is empty). Faceswap then has no usable mask source at all: neither the model nor the alignments can supply one. If a full-coverage stored mask existed, it would be auto-selected with a warning instead.
Source
Thrown at scripts/convert.py:197
if (not self._args.on_the_fly and
self._args.mask_type not in ("none", "predicted", "extended", "components") and
not self._alignments.mask_is_valid(self._args.mask_type)):
msg = (f"You have selected the Mask Type `{self._args.mask_type}` but at least one "
"face does not have this mask stored in the Alignments File.\nYou should "
"generate the required masks with the Mask Tool or set the Mask Type option to "
"an existing Mask Type.\nA summary of existing masks is as follows:\nTotal "
f"faces: {self._alignments.faces_count}, "
f"Masks: {self._alignments.mask_summary}")
raise FaceswapError(msg)
if self._args.mask_type == "predicted" and not self._predictor.has_predicted_mask:
available_masks = [k for k, v in self._alignments.mask_summary.items()
if k != "none" and v == self._alignments.faces_count]
if not available_masks:
msg = ("Predicted Mask selected, but the model was not trained with a mask and no "
"masks are stored in the Alignments File.\nYou should generate the "
"required masks with the Mask Tool or set the Mask Type to `none`.")
raise FaceswapError(msg)
mask_type = available_masks[0]
logger.warning("Predicted Mask selected, but the model was not trained with a "
"mask. Selecting first available mask: '%s'", mask_type)
self._args.mask_type = mask_type
def _add_queues(self) -> None:
"""Add the queues for in, patch and out."""
logger.debug("Adding queues. Queue size: %s", self._queue_size)
for qname in ("convert_in", "convert_out", "patch"):
queue_manager.add_queue(qname, self._queue_size)
def _get_threads(self) -> MultiThread:
"""Get the threads for patching the converted faces onto the frames.
Returns
-------
The threads that perform the patching of swapped faces onto the output frames
"""View on GitHub (pinned to f530cb7508)
Solutions
- Run tools.py mask to generate and store a full-coverage mask (e.g. extended, components) then re-run convert with -mask_type predicted (it will auto-fallback to the stored mask)
- Or set -mask_type to none if no masking is acceptable
- Long term: retrain the model with a mask (enable mask training) to get true predicted masks
Example fix
# before
python faceswap.py convert ... -mask_type predicted
# error: model has no mask, alignments have none
# after
python tools.py mask -i /data/frames -a /data/alignments.fsa \
-M extended --process all
python faceswap.py convert ... -mask_type predicted
# -> warns and falls back to 'extended' Defensive patterns
Strategy: validation
Validate before calling
if args.mask_type == "predicted" and not predictor.has_predicted_mask:
full = [k for k, v in alignments.mask_summary.items()
if k != "none" and v == alignments.faces_count]
if not full:
raise SystemExit("No predicted mask and no complete stored mask; "
"run tools.py mask or set -mask_type none") Prevention
- Train new models with a mask enabled so predicted masks are available at convert time
- Always generate at least one full-coverage stored mask (extended/components) during extraction
When it happens
Trigger: Converting with a model trained without learn_mask/mask output while the alignments file also contains no complete stored mask. available_masks filters for mask types where stored count == total face count and finds none.
Common situations: Old model trained before mask training was common, extraction done without any mask plugins enabled, or align file regenerated without masks.
Related errors
- You have selected the Mask Type `{self._args.mask_type}` but
- You have selected the mask type '{mask_type}' but at least o
- Landmark based masks cannot be created for {self._landmark_t
- There is a mismatch between the number of frames found in th
- The given shape {shape} is not valid. Valid shapes: {list(sh
AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15).
Data as JSON: /api/errors/cf59fa75e8d5d05e.
Report an issue: GitHub.