hacksider/Deep-Live-Cam · critical · FileNotFoundError

{NAME}: Model not found at {model_path}

Error message

{NAME}: Model not found at {model_path}

What it means

FileNotFoundError raised in get_face_enhancer (modules/processors/frame/face_enhancer.py) when the GFPGAN ONNX model file gfpgan-1024.onnx is not present in the application's models directory. Unlike the GPEN enhancers, this loader does NOT attempt an automatic download — it checks os.path.exists once and raises. The model artifact must be installed manually or by the project's setup/download script.

Source

Thrown at modules/processors/frame/face_enhancer.py:79

    ):
        update_status("Select an image or video for target path.", NAME)
        return False
    return True


def get_face_enhancer() -> onnxruntime.InferenceSession:
    """
    Initializes and returns the GFPGAN ONNX Runtime inference session,
    using the execution providers configured in modules.globals.
    """
    global FACE_ENHANCER

    with THREAD_LOCK:
        if FACE_ENHANCER is None:
            model_path = os.path.join(models_dir, "gfpgan-1024.onnx")

            if not os.path.exists(model_path):
                raise FileNotFoundError(
                    f"{NAME}: Model not found at {model_path}"
                )

            try:
                from modules.processors.frame._onnx_enhancer import (
                    create_onnx_session,
                )

                FACE_ENHANCER = create_onnx_session(model_path)

                input_info = FACE_ENHANCER.get_inputs()[0]
                output_info = FACE_ENHANCER.get_outputs()[0]
                active_providers = FACE_ENHANCER.get_providers()
                print(
                    f"{NAME}: GFPGAN ONNX model loaded successfully."
                )
                print(
                    f"{NAME}: Input: {input_info.name}, "

View on GitHub (pinned to 987f6b392b)

Solutions

  1. Place gfpgan-1024.onnx into the models directory the app uses (same directory the other enhancer models live in) — check the error message for the exact resolved path.
  2. Run the project's model download/setup script or manually download the GFPGAN 1024 ONNX weights from the project's documented source into that path.
  3. Verify the file name matches exactly (gfpgan-1024.onnx) and that the path in the error is the directory you actually populated.
  4. If downloads are managed elsewhere, mirror the auto-download pattern used by face_enhancer_gpen256.py (conditional_download) for this model.

Example fix

# before
def get_face_enhancer():
    model_path = os.path.join(models_dir, "gfpgan-1024.onnx")
    if not os.path.exists(model_path):
        raise FileNotFoundError(f"{NAME}: Model not found at {model_path}")

# after
def get_face_enhancer():
    model_path = os.path.join(models_dir, "gfpgan-1024.onnx")
    if not os.path.exists(model_path):
        from modules.utilities import conditional_download
        conditional_download(models_dir, [GFPGAN_MODEL_URL])
    if not os.path.exists(model_path):
        raise FileNotFoundError(f"{NAME}: Model not found at {model_path}")
Defensive patterns

Strategy: validation

Validate before calling

import os
model_path = os.path.join(models_dir, "gfpgan-1024.onnx")
if not os.path.exists(model_path):
    raise SystemExit(
        f"GFPGAN model missing at {model_path}; download it before running."
    )
session = get_face_enhancer()

Try / catch

try:
    session = get_face_enhancer()
except FileNotFoundError as e:
    # fail with an actionable message; no auto-fallback to a different model
    raise SystemExit(f"Missing model artifact: {e}")

Prevention

When it happens

Trigger: First run on a machine where the models directory does not yet contain gfpgan-1024.onnx; the models directory was cleared or the model file was deleted, renamed, or moved; running from a different working directory so models_dir resolves to a location without the file; a partial/interrupted model download left no file behind.

Common situations: Fresh clone or fresh deployment without running the model-download step; CI environments without cached model artifacts; the model file existing under a slightly different name (wrong quantization/variant); containers or packaged builds where the models folder was excluded to shrink the image.

Related errors


AI-assisted analysis of hacksider/Deep-Live-Cam@987f6b392b (2026-08-14). Data as JSON: /api/errors/b7cc2f07b1f8e7ce. Report an issue: GitHub.