From 4f600761dd729b6c65632d25660cd4efe8e6531c Mon Sep 17 00:00:00 2001 From: silveroxides Date: Sat, 3 Oct 2026 02:14:14 +0200 Subject: [PATCH] Make force_clear_cache default False across nodes --- nodes/consensus_merger.py | 6 +++--- nodes/cwb_delta_lora_merger.py | 2 +- nodes/dora_extract_wd.py | 2 +- nodes/dora_learned_wd.py | 2 +- nodes/lora_extract_svd.py | 2 +- nodes/merger.py | 20 ++++++++++---------- nodes/model_analysis.py | 2 +- nodes/text_encoder_extract.py | 2 +- tests/test_cwb_delta_lora_merger.py | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/nodes/consensus_merger.py b/nodes/consensus_merger.py index b4fce44..35354f3 100644 --- a/nodes/consensus_merger.py +++ b/nodes/consensus_merger.py @@ -2720,7 +2720,7 @@ def _common_inputs( ), io.Boolean.Input( "force_clear_cache", - default=True, + default=False, tooltip="Run Python garbage collection and clear the CUDA allocator cache before each layer. Reduces retained memory but can substantially slow merging.", ), io.Boolean.Input( @@ -2922,7 +2922,7 @@ class CWBLoRAMultiMerger(io.ComfyNode): io.String.Input("discard_patterns", default="", multiline=True, tooltip="Omit matching tensors or logical groups from the output."), io.Boolean.Input("glob_patterns", default=False, tooltip="Interpret filter entries as shell-style globs instead of regular expressions."), io.Boolean.Input("lazy_load", default=True, tooltip="Use bounded UEL work-unit streaming and release each completed input layer."), - io.Boolean.Input("force_clear_cache", default=True, tooltip="Collect Python and CUDA caches before each layer at a potential speed cost."), + io.Boolean.Input("force_clear_cache", default=False, tooltip="Collect Python and CUDA caches before each layer at a potential speed cost."), io.Boolean.Input("override_dtype", default=False, tooltip="Force generated floating factors to the requested save dtype."), io.Boolean.Input("include_1d_diffs", default=False, tooltip="CWB-merge 1D direct differences as FP32 instead of preserving the anchor."), io.Boolean.Input("counterfactual_weight_sweep", default=False, tooltip="Evaluate alpha, beta, similarity-threshold, DSC, and comfort-bandpass weight combinations from each already-computed consensus similarity vector and append them to the report without additional model loads or saved outputs."), @@ -2993,7 +2993,7 @@ def _embedding_coalesce_controls(default_filename: str): io.Combo.Input("save_dtype", options=["fp32", "fp16", "bf16"], default="fp32", tooltip="Requested dtype for generated floating embedding tensors."), io.Combo.Input("process_device", options=["cuda", "cpu"], default="cuda", tooltip="Per-tensor FP32 CWB arithmetic device; CUDA OOM retries that tensor on CPU."), io.Boolean.Input("lazy_load", default=True, tooltip="Use bounded UEL streaming and release each tensor after its work unit."), - io.Boolean.Input("force_clear_cache", default=True, tooltip="Clear Python and CUDA caches before each tensor at a possible speed cost."), + io.Boolean.Input("force_clear_cache", default=False, tooltip="Clear Python and CUDA caches before each tensor at a possible speed cost."), io.Boolean.Input("override_dtype", default=False, tooltip="Force generated floating tensors to Save Dtype."), ] diff --git a/nodes/cwb_delta_lora_merger.py b/nodes/cwb_delta_lora_merger.py index 11f7614..72ec51e 100644 --- a/nodes/cwb_delta_lora_merger.py +++ b/nodes/cwb_delta_lora_merger.py @@ -640,7 +640,7 @@ def _fixed_inputs(count, default_filename): ), io.Boolean.Input( "force_clear_cache", - default=True, + default=False, tooltip="Clear Python and CUDA caches before each layer to reduce retained memory.", ), io.Boolean.Input( diff --git a/nodes/dora_extract_wd.py b/nodes/dora_extract_wd.py index 46789ad..2ad830d 100644 --- a/nodes/dora_extract_wd.py +++ b/nodes/dora_extract_wd.py @@ -498,7 +498,7 @@ def extract_dora_from_files( chunk_large_layers: bool = True, svd_niter: int = 2, lazy_load: bool = True, - force_clear_cache: bool = True, + force_clear_cache: bool = False, glob_skip_patterns: bool = False, knee_probe_offset: int = 32, include_mode: bool = False, diff --git a/nodes/dora_learned_wd.py b/nodes/dora_learned_wd.py index 5014112..20ebd51 100644 --- a/nodes/dora_learned_wd.py +++ b/nodes/dora_learned_wd.py @@ -355,7 +355,7 @@ def extract_dora_learned_from_files( chunk_large_layers: bool = True, svd_niter: int = 2, lazy_load: bool = True, - force_clear_cache: bool = True, + force_clear_cache: bool = False, glob_skip_patterns: bool = False, knee_probe_offset: int = 32, include_mode: bool = False, diff --git a/nodes/lora_extract_svd.py b/nodes/lora_extract_svd.py index 2372711..7c9c9ba 100644 --- a/nodes/lora_extract_svd.py +++ b/nodes/lora_extract_svd.py @@ -498,7 +498,7 @@ def extract_lora_from_files( chunk_large_layers: bool = True, svd_niter: int = 2, lazy_load: bool = True, - force_clear_cache: bool = True, + force_clear_cache: bool = False, glob_skip_patterns: bool = False, include_1d_diffs: bool = False, knee_probe_offset: int = 32, diff --git a/nodes/merger.py b/nodes/merger.py index b72fb15..5c67375 100644 --- a/nodes/merger.py +++ b/nodes/merger.py @@ -514,7 +514,7 @@ class CheckpointTwoMerger(io.ComfyNode): tooltip="When True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). " "When False (default), patterns are Python regex matched as substrings."), io.Boolean.Input("lazy_load", default=True, tooltip="Low memory mode: load tensors from disk on demand"), - io.Boolean.Input("force_clear_cache", default=True, tooltip="Clear CUDA cache after each layer"), + io.Boolean.Input("force_clear_cache", default=False, tooltip="Clear CUDA cache after each layer"), io.Boolean.Input("override_dtype", default=False, tooltip="Force the entire model to be saved as the selected save_dtype. If False (default), higher precision dtypes are preserved."), io.Boolean.Input("include_mode", default=False, tooltip="Use Exclude Patterns as a whitelist instead. Only matching tensors are merged; nonmatching tensors are preserved from Model A."), parameter_input("merge"), @@ -584,7 +584,7 @@ class ModelTwoMerger(io.ComfyNode): tooltip="When True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). " "When False (default), patterns are Python regex matched as substrings."), io.Boolean.Input("lazy_load", default=True, tooltip="Low memory mode: load tensors from disk on demand"), - io.Boolean.Input("force_clear_cache", default=True, tooltip="Clear CUDA cache after each layer"), + io.Boolean.Input("force_clear_cache", default=False, tooltip="Clear CUDA cache after each layer"), io.Boolean.Input("override_dtype", default=False, tooltip="Force the entire model to be saved as the selected save_dtype. If False (default), higher precision dtypes are preserved."), io.Boolean.Input("include_mode", default=False, tooltip="Use Exclude Patterns as a whitelist instead. Only matching tensors are merged; nonmatching tensors are preserved from Model A."), parameter_input("merge"), @@ -654,7 +654,7 @@ class TextEncoderTwoMerger(io.ComfyNode): tooltip="When True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). " "When False (default), patterns are Python regex matched as substrings."), io.Boolean.Input("lazy_load", default=True, tooltip="Low memory mode: load tensors from disk on demand"), - io.Boolean.Input("force_clear_cache", default=True, tooltip="Clear CUDA cache after each layer"), + io.Boolean.Input("force_clear_cache", default=False, tooltip="Clear CUDA cache after each layer"), io.Boolean.Input("override_dtype", default=False, tooltip="Force the entire model to be saved as the selected save_dtype. If False (default), higher precision dtypes are preserved."), io.Boolean.Input("include_mode", default=False, tooltip="Use Exclude Patterns as a whitelist instead. Only matching tensors are merged; nonmatching tensors are preserved from Model A."), parameter_input("merge"), @@ -724,7 +724,7 @@ class LoRATwoMerger(io.ComfyNode): tooltip="When True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). " "When False (default), patterns are Python regex matched as substrings."), io.Boolean.Input("lazy_load", default=True, tooltip="Low memory mode: load tensors from disk on demand"), - io.Boolean.Input("force_clear_cache", default=True, tooltip="Clear CUDA cache after each layer"), + io.Boolean.Input("force_clear_cache", default=False, tooltip="Clear CUDA cache after each layer"), io.Boolean.Input("override_dtype", default=False, tooltip="Force merged non-1D tensors to save_dtype. Enabled 1D direct diffs remain FP32."), io.Boolean.Input("include_1d_diffs", default=False, tooltip="Merge 1D tensors. When disabled, preserve Model A's 1D tensors unchanged."), @@ -798,7 +798,7 @@ class EmbeddingTwoMerger(io.ComfyNode): tooltip="When True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). " "When False (default), patterns are Python regex matched as substrings."), io.Boolean.Input("lazy_load", default=True, tooltip="Low memory mode: load tensors from disk on demand"), - io.Boolean.Input("force_clear_cache", default=True, tooltip="Clear CUDA cache after each layer"), + io.Boolean.Input("force_clear_cache", default=False, tooltip="Clear CUDA cache after each layer"), io.Boolean.Input("override_dtype", default=False, tooltip="Force the entire model to be saved as the selected save_dtype. If False (default), higher precision dtypes are preserved."), io.Boolean.Input("include_mode", default=False, tooltip="Use Exclude Patterns as a whitelist instead. Only matching tensors are merged; nonmatching tensors are preserved from Model A."), parameter_input("merge"), @@ -871,7 +871,7 @@ class CheckpointThreeMerger(io.ComfyNode): tooltip="When True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). " "When False (default), patterns are Python regex matched as substrings."), io.Boolean.Input("lazy_load", default=True, tooltip="Low memory mode: load tensors from disk on demand"), - io.Boolean.Input("force_clear_cache", default=True, tooltip="Clear CUDA cache after each layer"), + io.Boolean.Input("force_clear_cache", default=False, tooltip="Clear CUDA cache after each layer"), io.Boolean.Input("override_dtype", default=False, tooltip="Force the entire model to be saved as the selected save_dtype. If False (default), higher precision dtypes are preserved."), io.Boolean.Input("include_mode", default=False, tooltip="Use Exclude Patterns as a whitelist instead. Only matching tensors are merged; nonmatching tensors are preserved from Model A."), parameter_input("merge"), @@ -942,7 +942,7 @@ class ModelThreeMerger(io.ComfyNode): tooltip="When True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). " "When False (default), patterns are Python regex matched as substrings."), io.Boolean.Input("lazy_load", default=True, tooltip="Low memory mode: load tensors from disk on demand"), - io.Boolean.Input("force_clear_cache", default=True, tooltip="Clear CUDA cache after each layer"), + io.Boolean.Input("force_clear_cache", default=False, tooltip="Clear CUDA cache after each layer"), io.Boolean.Input("override_dtype", default=False, tooltip="Force the entire model to be saved as the selected save_dtype. If False (default), higher precision dtypes are preserved."), io.Boolean.Input("include_mode", default=False, tooltip="Use Exclude Patterns as a whitelist instead. Only matching tensors are merged; nonmatching tensors are preserved from Model A."), parameter_input("merge"), @@ -1013,7 +1013,7 @@ class TextEncoderThreeMerger(io.ComfyNode): tooltip="When True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). " "When False (default), patterns are Python regex matched as substrings."), io.Boolean.Input("lazy_load", default=True, tooltip="Low memory mode: load tensors from disk on demand"), - io.Boolean.Input("force_clear_cache", default=True, tooltip="Clear CUDA cache after each layer"), + io.Boolean.Input("force_clear_cache", default=False, tooltip="Clear CUDA cache after each layer"), io.Boolean.Input("override_dtype", default=False, tooltip="Force the entire model to be saved as the selected save_dtype. If False (default), higher precision dtypes are preserved."), io.Boolean.Input("include_mode", default=False, tooltip="Use Exclude Patterns as a whitelist instead. Only matching tensors are merged; nonmatching tensors are preserved from Model A."), parameter_input("merge"), @@ -1084,7 +1084,7 @@ class LoRAThreeMerger(io.ComfyNode): tooltip="When True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). " "When False (default), patterns are Python regex matched as substrings."), io.Boolean.Input("lazy_load", default=True, tooltip="Low memory mode: load tensors from disk on demand"), - io.Boolean.Input("force_clear_cache", default=True, tooltip="Clear CUDA cache after each layer"), + io.Boolean.Input("force_clear_cache", default=False, tooltip="Clear CUDA cache after each layer"), io.Boolean.Input("override_dtype", default=False, tooltip="Force merged non-1D tensors to save_dtype. Enabled 1D direct diffs remain FP32."), io.Boolean.Input("include_1d_diffs", default=False, tooltip="Merge 1D tensors. When disabled, preserve Model A's 1D tensors unchanged."), @@ -1159,7 +1159,7 @@ class EmbeddingThreeMerger(io.ComfyNode): tooltip="When True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). " "When False (default), patterns are Python regex matched as substrings."), io.Boolean.Input("lazy_load", default=True, tooltip="Low memory mode: load tensors from disk on demand"), - io.Boolean.Input("force_clear_cache", default=True, tooltip="Clear CUDA cache after each layer"), + io.Boolean.Input("force_clear_cache", default=False, tooltip="Clear CUDA cache after each layer"), io.Boolean.Input("override_dtype", default=False, tooltip="Force the entire model to be saved as the selected save_dtype. If False (default), higher precision dtypes are preserved."), io.Boolean.Input("include_mode", default=False, tooltip="Use Exclude Patterns as a whitelist instead. Only matching tensors are merged; nonmatching tensors are preserved from Model A."), parameter_input("merge"), diff --git a/nodes/model_analysis.py b/nodes/model_analysis.py index cde897b..a7a00ce 100644 --- a/nodes/model_analysis.py +++ b/nodes/model_analysis.py @@ -1243,7 +1243,7 @@ def _common_inputs(model_type: str, *, alignment_control: bool): ), io.Boolean.Input( "force_clear_cache", - default=True, + default=False, tooltip="Run garbage collection and clear the CUDA allocator cache after every analyzed work unit. Saves retained memory but slows analysis.", ), io.String.Input( diff --git a/nodes/text_encoder_extract.py b/nodes/text_encoder_extract.py index a80da4b..a6af4d7 100644 --- a/nodes/text_encoder_extract.py +++ b/nodes/text_encoder_extract.py @@ -79,7 +79,7 @@ def extract_te_from_files( chunk_large_layers: bool = True, svd_niter: int = 2, lazy_load: bool = True, - force_clear_cache: bool = True, + force_clear_cache: bool = False, glob_skip_patterns: bool = False, knee_probe_offset: int = 32, include_mode: bool = False, diff --git a/tests/test_cwb_delta_lora_merger.py b/tests/test_cwb_delta_lora_merger.py index e05541b..b406fe3 100644 --- a/tests/test_cwb_delta_lora_merger.py +++ b/tests/test_cwb_delta_lora_merger.py @@ -390,7 +390,7 @@ def test_exact_node_schema_contract(delta_cwb): assert schemas[0].inputs[7].default == "full_difference" assert schemas[0].inputs[8].default == 384 assert schemas[0].inputs[9].default == "cuda" - assert schemas[0].inputs[-2].default is True + assert schemas[0].inputs[-2].default is False assert schemas[0].inputs[-1].default is False assert "agreement" in schemas[0].inputs[2].tooltip assert "Only a failed CUDA layer retries on CPU" in schemas[0].inputs[9].tooltip