mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-04-29 18:51:31 +00:00
simplify
This commit is contained in:
@@ -493,11 +493,10 @@ def free_memory(memory_required, device, keep_loaded=[]):
|
|||||||
def compute_model_gpu_memory_when_using_cpu_swap(current_free_mem, inference_memory):
|
def compute_model_gpu_memory_when_using_cpu_swap(current_free_mem, inference_memory):
|
||||||
maximum_memory_available = current_free_mem - inference_memory
|
maximum_memory_available = current_free_mem - inference_memory
|
||||||
|
|
||||||
k_1GB = float(inference_memory / (1024 * 1024 * 1024))
|
suggestion = max(
|
||||||
k_1GB = max(0.0, min(1.0, k_1GB))
|
maximum_memory_available / 1.3,
|
||||||
|
maximum_memory_available - 1024 * 1024 * 1024 * 1.25
|
||||||
adaptive_safe_factor = 1.0 - 0.23 * k_1GB
|
)
|
||||||
suggestion = max(maximum_memory_available * adaptive_safe_factor, maximum_memory_available - 1024 * 1024 * 1024 * 1.25)
|
|
||||||
|
|
||||||
return int(max(0, suggestion))
|
return int(max(0, suggestion))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user