Merge pull request #1732 from yetval/fix/cuda-vram-exhaustion-video-processing

Fix CUDA VRAM exhaustion during video processing
This commit is contained in:
Kenneth Estanislao
2026-04-05 23:15:38 +08:00
committed by GitHub
2 changed files with 9 additions and 2 deletions
+1 -2
View File
@@ -143,8 +143,7 @@ def suggest_execution_threads() -> int:
if 'ROCMExecutionProvider' in modules.globals.execution_providers:
return 1
if 'CUDAExecutionProvider' in modules.globals.execution_providers:
# For CUDA, use more threads for parallel frame processing
return min(cpu_count, 16)
return 2
# For CPU execution, use most cores but leave some for system
return max(4, min(cpu_count - 2, 16))
+8
View File
@@ -108,6 +108,14 @@ def get_face_swapper() -> Any:
"MaximumCacheSize": 1024 * 1024 * 512, # 512MB cache
}
))
elif p == "CUDAExecutionProvider":
providers_config.append((
"CUDAExecutionProvider",
{
"arena_extend_strategy": "kSameAsRequested",
"cudnn_conv_algo_search": "DEFAULT",
}
))
else:
providers_config.append(p)
FACE_SWAPPER = insightface.model_zoo.get_model(