Fix CUDA VRAM exhaustion during video processing (#1721)

This commit is contained in:
yetval
2026-04-02 22:58:47 -04:00
parent 1edc4bc298
commit 11fb5bfbc6
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(