hacksider/Deep-Live-Cam · critical · FileNotFoundError
Model file not found: {model_path}
Error message
Model file not found: {model_path} What it means
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.
Source
Thrown at modules/processors/frame/face_enhancer_gpen512.py:62
def pre_start() -> bool:
if not is_image(modules.globals.target_path) and not is_video(modules.globals.target_path):
update_status("Select an image or video for target path.", NAME)
return False
return True
def get_enhancer() -> Any:
global ENHANCER
with THREAD_LOCK:
if ENHANCER is None:
model_path = os.path.join(models_dir, MODEL_FILE)
if not os.path.exists(model_path):
from modules.utilities import conditional_download
conditional_download(models_dir, [MODEL_URL])
if not os.path.exists(model_path):
raise FileNotFoundError(f"Model file not found: {model_path}")
print(f"{NAME}: Loading ONNX model from {model_path}")
ENHANCER = create_onnx_session(model_path)
warmup_session(ENHANCER)
print(f"{NAME}: Model loaded successfully.")
return ENHANCER
def enhance_face(temp_frame: Frame, face: Face) -> Frame:
try:
session = get_enhancer()
except Exception as e:
print(f"{NAME}: {e}")
return temp_frame
try:
return enhance_face_onnx(temp_frame, face, session, INPUT_SIZE)
except Exception as e:
print(f"{NAME}: Error during face enhancement: {e}")
return temp_frameView on GitHub (pinned to 987f6b392b)
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.
Example fix
# before # auto-download of the large 512 model fails behind a slow proxy session = get_enhancer() # after # pre-download out-of-band and mount the models dir read-only: # curl -L --retry 3 -o <models_dir>/<MODEL_FILE> <MODEL_URL> session = get_enhancer()
Defensive patterns
Strategy: validation
Validate before calling
import os, urllib.request
model_path = os.path.join(models_dir, MODEL_FILE) # MODEL_FILE from face_enhancer_gpen512
if not os.path.exists(model_path):
os.makedirs(models_dir, exist_ok=True)
urllib.request.urlretrieve(MODEL_URL, model_path)
session = get_enhancer() Try / catch
try:
session = get_enhancer()
except FileNotFoundError as e:
raise SystemExit(
f"Model download failed: {e}. Fetch {MODEL_URL} into {models_dir} manually."
) Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Model file not found: {model_path}
- {NAME}: Model not found at {model_path}
- {NAME}: Failed to initialize GFPGAN ONNX session. Check logs
- embeddings must not be empty
- max_k must be at least 1
AI-assisted analysis of hacksider/Deep-Live-Cam@987f6b392b (2026-08-14).
Data as JSON: /api/errors/c9d9deb8ee97236f.
Report an issue: GitHub.