Skip to content

Face swapper model fails to load - inconsistent model filename in code #1628

@Ranb972

Description

@Ranb972

Bug Description

The face swapper model fails to load due to inconsistent model filename references in the code. The application searches for both inswapper_128.onnx and inswapper_128_fp16.onnx at different times, but the documentation instructs users to download inswapper_128_fp16.onnx.

Environment

  • OS: Windows 11
  • Deep-Live-Cam Version: 2.0.1c
  • Python Version: 3.11.9
  • Execution Provider: CUDA (CUDAExecutionProvider)
  • GPU: NVIDIA GeForce RTX 4050 Laptop GPU
  • CUDA Version: 12.8
  • cuDNN Version: 8.9.7

Steps to Reproduce

  1. Follow the installation instructions from README
  2. Download the model files as instructed:
    • GFPGANv1.4.pth
    • inswapper_128_fp16.onnx (as per documentation)
  3. Place files in models/ directory
  4. Run: python run.py --execution-provider cuda
  5. Select a source face and click "Live"

Expected Behavior

The face swapper model should load successfully and swap faces in real-time.

Actual Behavior

The application repeatedly fails to load the model with the error:

[DLC.FACE-SWAPPER] Loading face swapper model from: C:\Deep-Live-Cam\models\inswapper_128_fp16.onnx
[DLC.FACE-SWAPPER] Error loading face swapper model: model_file C:\Deep-Live-Cam\models\inswapper_128_fp16.onnx should exist
[DLC.FACE-SWAPPER] Face swapper model not loaded or failed to load. Skipping swap.

Sometimes it also searches for inswapper_128.onnx (without _fp16).

Console Output

Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']
[DLC.FACE-SWAPPER] Loading face swapper model from: C:\Deep-Live-Cam\models\inswapper_128_fp16.onnx
[DLC.FACE-SWAPPER] Error loading face swapper model: model_file C:\Deep-Live-Cam\models\inswapper_128_fp16.onnx should exist
[DLC.FACE-SWAPPER] Face swapper model not loaded or failed to load. Skipping swap.

Impact

  • Face swapping functionality completely non-functional
  • Only Face Enhancer works (with CUDA)
  • Application shows FPS: 3-4 (very slow due to missing face swap model)
  • No actual face replacement occurs - only blur/enhancement

Additional Information

  • The file inswapper_128_fp16.onnx exists in the models/ directory
  • File size: ~528 MB (downloaded from the official HuggingFace link)
  • GFPGANv1.4.pth loads successfully
  • CUDA is properly configured and working (confirmed via PyTorch and ONNX Runtime tests)

Possible Solution

The code should consistently reference the correct model filename. Either:

  1. Update code to use inswapper_128_fp16.onnx everywhere, OR
  2. Update documentation to instruct users to rename the file to inswapper_128.onnx

Verification

I verified that:

  • ✅ PyTorch sees CUDA: torch.cuda.is_available() returns True
  • ✅ ONNX Runtime has CUDA: ort.get_available_providers() includes CUDAExecutionProvider
  • ✅ GPU is properly configured in Windows Graphics Settings
  • ✅ All dependencies installed correctly
  • ❌ Face swapper model fails to load

Thank you for this amazing project! Looking forward to seeing this resolved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions