Merge pull request #1707 from rohanrathi99/main

Switch to FP32 model by default, add run script
This commit is contained in:
Kenneth Estanislao
2026-04-05 23:19:17 +08:00
committed by GitHub
2 changed files with 19 additions and 4 deletions
+4 -4
View File
@@ -54,11 +54,11 @@ def pre_check() -> bool:
logging.error(f"Failed to create directory {download_directory_path} due to permission error: {e}")
return False
# Use the direct download URL from Hugging Face
# Use the direct download URL from Hugging Face (FP32 model for broad GPU compatibility)
conditional_download(
download_directory_path,
[
"https://huggingface.co/hacksider/deep-live-cam/resolve/main/inswapper_128_fp16.onnx"
"https://huggingface.co/hacksider/deep-live-cam/resolve/main/inswapper_128.onnx"
],
)
return True
@@ -85,9 +85,9 @@ def get_face_swapper() -> Any:
with THREAD_LOCK:
if FACE_SWAPPER is None:
# Use FP32 model by default for broad GPU compatibility.
# FP16 can produce NaN on GPUs without Tensor Cores (e.g. GTX 16xx).
model_name = "inswapper_128.onnx"
if "CUDAExecutionProvider" in modules.globals.execution_providers:
model_name = "inswapper_128_fp16.onnx"
model_path = os.path.join(models_dir, model_name)
update_status(f"Loading face swapper model from: {model_path}", NAME)
try:
+15
View File
@@ -1,5 +1,20 @@
#!/usr/bin/env python3
import os
import sys
# Add the project root to PATH so bundled ffmpeg/ffprobe are found
project_root = os.path.dirname(os.path.abspath(__file__))
os.environ["PATH"] = project_root + os.pathsep + os.environ.get("PATH", "")
# Add NVIDIA CUDA DLL directories to PATH so onnxruntime-gpu can find them
nvidia_dir = os.path.join(project_root, "venv", "Lib", "site-packages", "nvidia")
if os.path.isdir(nvidia_dir):
for pkg in os.listdir(nvidia_dir):
bin_dir = os.path.join(nvidia_dir, pkg, "bin")
if os.path.isdir(bin_dir):
os.environ["PATH"] = bin_dir + os.pathsep + os.environ["PATH"]
# Import the tkinter fix to patch the ScreenChanged error
import tkinter_fix