From 4aadfdf2ca86c9b8873adb92988aea3e11a1eed3 Mon Sep 17 00:00:00 2001 From: KRSHH <136873090+KRSHH@users.noreply.github.com> Date: Thu, 7 Nov 2024 10:41:00 +0530 Subject: [PATCH] Full GPU Utilization --- modules/processors/frame/face_swapper.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/processors/frame/face_swapper.py b/modules/processors/frame/face_swapper.py index 3ac1088..e25fb6e 100644 --- a/modules/processors/frame/face_swapper.py +++ b/modules/processors/frame/face_swapper.py @@ -58,17 +58,17 @@ def get_face_swapper() -> Any: FACE_SWAPPER = insightface.model_zoo.get_model( model_path, providers=modules.globals.execution_providers ) - # Set optimal inference parameters + # Set optimal inference parameters for maximum VRAM usage if hasattr(FACE_SWAPPER, "session"): FACE_SWAPPER.session.set_providers(["CUDAExecutionProvider"]) FACE_SWAPPER.session.set_provider_options( { "CUDAExecutionProvider": { - "cuda_mem_limit": 2 * 1024 * 1024 * 1024, # 2GB VRAM limit - "arena_extend_strategy": "kNextPowerOfTwo", - "gpu_mem_limit": 2 * 1024 * 1024 * 1024, - "cudnn_conv_algo_search": "EXHAUSTIVE", + "arena_extend_strategy": "kSameAsRequested", # More aggressive memory allocation + "cudnn_conv_algo_search": "EXHAUSTIVE", # Try all possible algorithms "do_copy_in_default_stream": True, + "gpu_mem_limit": 0, + "cuda_mem_limit": 0, } } )