Full GPU Utilization
							parent
							
								
									0187936c18
								
							
						
					
					
						commit
						4aadfdf2ca
					
				| 
						 | 
					@ -58,17 +58,17 @@ def get_face_swapper() -> Any:
 | 
				
			||||||
            FACE_SWAPPER = insightface.model_zoo.get_model(
 | 
					            FACE_SWAPPER = insightface.model_zoo.get_model(
 | 
				
			||||||
                model_path, providers=modules.globals.execution_providers
 | 
					                model_path, providers=modules.globals.execution_providers
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
            # Set optimal inference parameters
 | 
					            # Set optimal inference parameters for maximum VRAM usage
 | 
				
			||||||
            if hasattr(FACE_SWAPPER, "session"):
 | 
					            if hasattr(FACE_SWAPPER, "session"):
 | 
				
			||||||
                FACE_SWAPPER.session.set_providers(["CUDAExecutionProvider"])
 | 
					                FACE_SWAPPER.session.set_providers(["CUDAExecutionProvider"])
 | 
				
			||||||
                FACE_SWAPPER.session.set_provider_options(
 | 
					                FACE_SWAPPER.session.set_provider_options(
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        "CUDAExecutionProvider": {
 | 
					                        "CUDAExecutionProvider": {
 | 
				
			||||||
                            "cuda_mem_limit": 2 * 1024 * 1024 * 1024,  # 2GB VRAM limit
 | 
					                            "arena_extend_strategy": "kSameAsRequested",  # More aggressive memory allocation
 | 
				
			||||||
                            "arena_extend_strategy": "kNextPowerOfTwo",
 | 
					                            "cudnn_conv_algo_search": "EXHAUSTIVE",  # Try all possible algorithms
 | 
				
			||||||
                            "gpu_mem_limit": 2 * 1024 * 1024 * 1024,
 | 
					 | 
				
			||||||
                            "cudnn_conv_algo_search": "EXHAUSTIVE",
 | 
					 | 
				
			||||||
                            "do_copy_in_default_stream": True,
 | 
					                            "do_copy_in_default_stream": True,
 | 
				
			||||||
 | 
					                            "gpu_mem_limit": 0,  
 | 
				
			||||||
 | 
					                            "cuda_mem_limit": 0, 
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue