Add Torch GC threshold slider

This commit is contained in:
Disty0
2023-09-28 14:38:22 +03:00
parent f78c5c6423
commit 5edf481c8d
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -116,7 +116,7 @@ def torch_gc(force=False):
if oom > previous_oom:
previous_oom = oom
log.warning(f'GPU out-of-memory error: {mem}')
if used > 90:
if used > shared.opts.torch_gc_threshold:
log.info(f'GPU high memory utilization: {used}% {mem}')
force = True
if not force:
+1
View File
@@ -415,6 +415,7 @@ options_templates.update(options_section(('cuda', "Compute Settings"), {
"cudnn_benchmark": OptionInfo(False, "Enable full-depth cuDNN benchmark feature"),
"ipex_optimize": OptionInfo(True if devices.backend == "ipex" else False, "Enable IPEX Optimize for Intel GPUs"),
"directml_memory_provider": OptionInfo(default_memory_provider, 'DirectML memory stats provider', gr.Radio, lambda: {"choices": memory_providers}),
"torch_gc_threshold": OptionInfo(90, "VRAM usage threshold before running Torch GC to clear up VRAM", gr.Slider, {"minimum": 0, "maximum": 100, "step": 1}),
"cuda_compile_sep": OptionInfo("<h2>Model Compile</h2>", "", gr.HTML),
"cuda_compile": OptionInfo(True if cmd_opts.use_openvino else False, "Enable model compile"),
"cuda_compile_backend": OptionInfo("openvino_fx" if cmd_opts.use_openvino else "none", "Model compile backend", gr.Radio, lambda: {"choices": ['none', 'inductor', 'cudagraphs', 'aot_ts_nvfuser', 'hidet', 'ipex', 'openvino_fx']}),