{"record":{"id":"b7cc2f07b1f8e7ce","repo":"hacksider/Deep-Live-Cam","slug":"name-model-not-found-at-model-path","errorCode":null,"errorMessage":"{NAME}: Model not found at {model_path}","messagePattern":"(.+?): Model not found at (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"critical","filePath":"modules/processors/frame/face_enhancer.py","lineNumber":79,"sourceCode":"    ):\n        update_status(\"Select an image or video for target path.\", NAME)\n        return False\n    return True\n\n\ndef get_face_enhancer() -> onnxruntime.InferenceSession:\n    \"\"\"\n    Initializes and returns the GFPGAN ONNX Runtime inference session,\n    using the execution providers configured in modules.globals.\n    \"\"\"\n    global FACE_ENHANCER\n\n    with THREAD_LOCK:\n        if FACE_ENHANCER is None:\n            model_path = os.path.join(models_dir, \"gfpgan-1024.onnx\")\n\n            if not os.path.exists(model_path):\n                raise FileNotFoundError(\n                    f\"{NAME}: Model not found at {model_path}\"\n                )\n\n            try:\n                from modules.processors.frame._onnx_enhancer import (\n                    create_onnx_session,\n                )\n\n                FACE_ENHANCER = create_onnx_session(model_path)\n\n                input_info = FACE_ENHANCER.get_inputs()[0]\n                output_info = FACE_ENHANCER.get_outputs()[0]\n                active_providers = FACE_ENHANCER.get_providers()\n                print(\n                    f\"{NAME}: GFPGAN ONNX model loaded successfully.\"\n                )\n                print(\n                    f\"{NAME}: Input: {input_info.name}, \"","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/hacksider/Deep-Live-Cam/blob/987f6b392b1740623b3fa8a5cb46fdd0b7e185b9/modules/processors/frame/face_enhancer.py#L61-L97","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","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.","Verify the file name matches exactly (gfpgan-1024.onnx) and that the path in the error is the directory you actually populated.","If downloads are managed elsewhere, mirror the auto-download pattern used by face_enhancer_gpen256.py (conditional_download) for this model."],"exampleFix":"# before\ndef get_face_enhancer():\n    model_path = os.path.join(models_dir, \"gfpgan-1024.onnx\")\n    if not os.path.exists(model_path):\n        raise FileNotFoundError(f\"{NAME}: Model not found at {model_path}\")\n\n# after\ndef get_face_enhancer():\n    model_path = os.path.join(models_dir, \"gfpgan-1024.onnx\")\n    if not os.path.exists(model_path):\n        from modules.utilities import conditional_download\n        conditional_download(models_dir, [GFPGAN_MODEL_URL])\n    if not os.path.exists(model_path):\n        raise FileNotFoundError(f\"{NAME}: Model not found at {model_path}\")","handlingStrategy":"validation","validationCode":"import os\nmodel_path = os.path.join(models_dir, \"gfpgan-1024.onnx\")\nif not os.path.exists(model_path):\n    raise SystemExit(\n        f\"GFPGAN model missing at {model_path}; download it before running.\"\n    )\nsession = get_face_enhancer()","typeGuard":null,"tryCatchPattern":"try:\n    session = get_face_enhancer()\nexcept FileNotFoundError as e:\n    # fail with an actionable message; no auto-fallback to a different model\n    raise SystemExit(f\"Missing model artifact: {e}\")","preventionTips":["Pre-download all ONNX models as a deployment/setup step and verify presence at startup.","Cache the models directory in CI/build artifacts so every environment is pre-seeded.","Fail fast at app startup (check file existence) instead of at first enhancement request."],"tags":["python","onnx","onnxruntime","model-download","file-not-found","face-enhancement"],"backgroundTag":null,"analyzedSha":"987f6b392b1740623b3fa8a5cb46fdd0b7e185b9","analyzedAt":"2026-08-14T19:48:25.860Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}