mirror of
https://github.com/hacksider/Deep-Live-Cam.git
synced 2026-07-25 19:41:00 +02:00
fix: centralize OPENVINO_PROVIDER_CONFIG and log SystemExit
Address Sourcery review feedback on PR #1879: - Move OPENVINO_PROVIDER_CONFIG from _onnx_enhancer.py to platform_info.py (a leaf module with no modules.* imports), so the enhancer and face_swapper no longer import each other just to share a constant. _onnx_enhancer re-exports it; face_swapper now imports it at module top level instead of inside get_face_swapper(). - Narrow run.py's SystemExit handling: catch SystemExit separately and print a [startup] message so the failure is visible instead of being swallowed alongside ImportError/FileNotFoundError.
This commit is contained in:
@@ -14,17 +14,13 @@ import numpy as np
|
||||
import onnxruntime
|
||||
|
||||
import modules.globals
|
||||
from modules.platform_info import OPENVINO_PROVIDER_CONFIG
|
||||
|
||||
IS_APPLE_SILICON = platform.system() == "Darwin" and platform.machine() == "arm64"
|
||||
|
||||
# Limit concurrent ONNX calls to avoid VRAM exhaustion on multi-face frames
|
||||
THREAD_SEMAPHORE = threading.Semaphore(min(max(1, (os.cpu_count() or 1)), 8))
|
||||
|
||||
# OpenVINO provider configuration.
|
||||
# AUTO:GPU,NPU,CPU lets OpenVINO try the best available device in priority
|
||||
# order (Intel GPU → NPU → CPU).
|
||||
OPENVINO_PROVIDER_CONFIG = ("OpenVINOExecutionProvider", {"device_type": "AUTO:GPU,NPU,CPU"})
|
||||
|
||||
|
||||
def build_provider_config(providers=None):
|
||||
"""Wrap raw provider name strings with optimised CUDA / CoreML options.
|
||||
|
||||
@@ -18,6 +18,7 @@ from modules.utilities import (
|
||||
)
|
||||
from modules.cluster_analysis import find_closest_centroid
|
||||
from modules.gpu_processing import gpu_gaussian_blur, gpu_sharpen, gpu_add_weighted, gpu_resize
|
||||
from modules.platform_info import OPENVINO_PROVIDER_CONFIG
|
||||
import os
|
||||
from collections import deque
|
||||
import time
|
||||
@@ -271,9 +272,6 @@ def get_face_swapper() -> Any:
|
||||
# fastest on modern GPUs (Blackwell/sm_120).
|
||||
providers_config.append(p)
|
||||
elif p == "OpenVINOExecutionProvider":
|
||||
from modules.processors.frame._onnx_enhancer import (
|
||||
OPENVINO_PROVIDER_CONFIG,
|
||||
)
|
||||
providers_config.append(OPENVINO_PROVIDER_CONFIG)
|
||||
else:
|
||||
providers_config.append(p)
|
||||
|
||||
Reference in New Issue
Block a user