{"record":{"id":"c9d9deb8ee97236f","repo":"hacksider/Deep-Live-Cam","slug":"model-file-not-found-model-path-c9d9de","errorCode":null,"errorMessage":"Model file not found: {model_path}","messagePattern":"Model file not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"critical","filePath":"modules/processors/frame/face_enhancer_gpen512.py","lineNumber":62,"sourceCode":"\n\ndef pre_start() -> bool:\n    if not is_image(modules.globals.target_path) and not is_video(modules.globals.target_path):\n        update_status(\"Select an image or video for target path.\", NAME)\n        return False\n    return True\n\n\ndef get_enhancer() -> Any:\n    global ENHANCER\n    with THREAD_LOCK:\n        if ENHANCER is None:\n            model_path = os.path.join(models_dir, MODEL_FILE)\n            if not os.path.exists(model_path):\n                from modules.utilities import conditional_download\n                conditional_download(models_dir, [MODEL_URL])\n            if not os.path.exists(model_path):\n                raise FileNotFoundError(f\"Model file not found: {model_path}\")\n            print(f\"{NAME}: Loading ONNX model from {model_path}\")\n            ENHANCER = create_onnx_session(model_path)\n            warmup_session(ENHANCER)\n            print(f\"{NAME}: Model loaded successfully.\")\n    return ENHANCER\n\n\ndef enhance_face(temp_frame: Frame, face: Face) -> Frame:\n    try:\n        session = get_enhancer()\n    except Exception as e:\n        print(f\"{NAME}: {e}\")\n        return temp_frame\n    try:\n        return enhance_face_onnx(temp_frame, face, session, INPUT_SIZE)\n    except Exception as e:\n        print(f\"{NAME}: Error during face enhancement: {e}\")\n        return temp_frame","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/hacksider/Deep-Live-Cam/blob/987f6b392b1740623b3fa8a5cb46fdd0b7e185b9/modules/processors/frame/face_enhancer_gpen512.py#L44-L80","documentation":"FileNotFoundError raised in get_enhancer (modules/processors/frame/face_enhancer_gpen512.py) when the GPEN 512px ONNX model is still missing after the automatic download attempt. Identical logic to the 256px variant: check file, conditional_download from MODEL_URL, re-check, raise with the resolved path if absent. The 512px model is a separate, larger file with its own MODEL_FILE/MODEL_URL constants in this module.","triggerScenarios":"Same as the 256 variant but for the 512px weights: offline/blocked network during conditional_download; the 512 model's URL dead or moved; models dir unwritable or full; the 256 model downloaded fine but the 512 download failed partway (larger file, more exposed to timeouts).","commonSituations":"Environments that allow the smaller 256 model through but time out on the larger 512 file; selectively cached model dirs where only some variants were pre-seeded; proxy size limits; container images pre-built with only the 256 model.","solutions":["Manually download the 512px model using the MODEL_URL defined in face_enhancer_gpen512.py and place it under the exact MODEL_FILE name in the models dir.","If auto-download timed out on the large file, retry on a stable connection or use a resumable downloader; verify final file size.","Confirm the models directory is writable and has space for the larger weights.","Pre-seed the model in deployment images so runtime download is never needed."],"exampleFix":"# before\n# auto-download of the large 512 model fails behind a slow proxy\nsession = get_enhancer()\n\n# after\n# pre-download out-of-band and mount the models dir read-only:\n# curl -L --retry 3 -o <models_dir>/<MODEL_FILE> <MODEL_URL>\nsession = get_enhancer()","handlingStrategy":"validation","validationCode":"import os, urllib.request\nmodel_path = os.path.join(models_dir, MODEL_FILE)  # MODEL_FILE from face_enhancer_gpen512\nif not os.path.exists(model_path):\n    os.makedirs(models_dir, exist_ok=True)\n    urllib.request.urlretrieve(MODEL_URL, model_path)\nsession = get_enhancer()","typeGuard":null,"tryCatchPattern":"try:\n    session = get_enhancer()\nexcept FileNotFoundError as e:\n    raise SystemExit(\n        f\"Model download failed: {e}. Fetch {MODEL_URL} into {models_dir} manually.\"\n    )","preventionTips":["Pre-download the larger 512px weights out-of-band; they are the most likely to time out.","Verify downloaded file size matches the source to catch partial transfers.","Keep both GPEN variants in the same pre-seeded models cache so none fetch at runtime."],"tags":["python","onnx","model-download","network","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"}