From fdb27bb5afcddb0b524703ebb63bce09ab3043a2 Mon Sep 17 00:00:00 2001 From: QualiaRain <44004657+QualiaRain@users.noreply.github.com> Date: Fri, 19 Jun 2026 14:07:43 -0400 Subject: [PATCH] fix(control): SegmentAnything fails to load after processor rename The "processors multiple fixes" rename split 'SegmentAnything' / 'SAM 2.1' into 'SegmentAnything 1.0' / 'SegmentAnything 2.1' but left Processor.load() matching the old name by substring: elif 'SegmentAnything' in processor_id: ... config['SegmentAnything']['model'] ... Post-rename this (a) raises KeyError because 'SegmentAnything' is no longer a config key, so both SAM processors fail to load, and (b) wrongly routes 'SegmentAnything 2.1' (a Sam2Detector loaded via load_config) into the SAM-v1 weight path instead of letting it fall through to the generic load_config branch. Match the v1 id exactly and key off config[processor_id], restoring the pre-rename routing: v1.0 -> explicit SAM-v1 branch, v2.1 -> load_config. Co-Authored-By: Claude --- modules/control/processors.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/control/processors.py b/modules/control/processors.py index 37d7d926d..34ef10cef 100644 --- a/modules/control/processors.py +++ b/modules/control/processors.py @@ -282,10 +282,10 @@ class Processor: elif processor_id in ('DWPose (ONNX)', 'RTMW', 'RTMO'): model_type = {'DWPose (ONNX)': 'DWPose', 'RTMW': 'RTMW-l', 'RTMO': 'RTMO-l'}[processor_id] self.model = cls.from_pretrained(model_type, **self.load_config) - elif 'SegmentAnything' in processor_id: - if 'Base' == config['SegmentAnything']['model']: + elif processor_id == 'SegmentAnything 1.0': + if 'Base' == config[processor_id]['model']: self.model = cls.from_pretrained(model_path = 'segments-arnaud/sam_vit_b', filename='sam_vit_b_01ec64.pth', model_type='vit_b', **self.load_config) - elif 'Large' == config['SegmentAnything']['model']: + elif 'Large' == config[processor_id]['model']: self.model = cls.from_pretrained(model_path = 'segments-arnaud/sam_vit_l', filename='sam_vit_l_0b3195.pth', model_type='vit_l', **self.load_config) else: log.error(f'Control Processor load failed: id="{processor_id}" error=unknown model type')