mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
fix(config): prioritize checkpoints over unet when paths overlap, #799
When checkpoints and unet folders point to the same physical location (via symlinks), prioritize checkpoints for backward compatibility. This prevents the 'Failed to load Checkpoint root' error that users experience when they have incorrectly configured their ComfyUI paths. Changes: - Detect overlapping real paths between checkpoints and unet - Log warning to inform users of the configuration issue - Remove overlapping paths from unet_map, keeping checkpoints Fixes #<issue-number>
This commit is contained in:
17
py/config.py
17
py/config.py
@@ -645,6 +645,23 @@ class Config:
|
||||
checkpoint_map = self._dedupe_existing_paths(checkpoint_paths)
|
||||
unet_map = self._dedupe_existing_paths(unet_paths)
|
||||
|
||||
# Detect when checkpoints and unet share the same physical location
|
||||
# This is a configuration issue that can cause duplicate model entries
|
||||
overlapping_real_paths = set(checkpoint_map.keys()) & set(unet_map.keys())
|
||||
if overlapping_real_paths:
|
||||
logger.warning(
|
||||
"Detected overlapping paths between 'checkpoints' and 'diffusion_models' (unet). "
|
||||
"They should not point to the same physical folder as they are different model types. "
|
||||
"Please fix your ComfyUI path configuration to separate these folders. "
|
||||
"Falling back to 'checkpoints' for backward compatibility. "
|
||||
"Overlapping real paths: %s",
|
||||
[checkpoint_map.get(rp, rp) for rp in overlapping_real_paths]
|
||||
)
|
||||
# Remove overlapping paths from unet_map to prioritize checkpoints
|
||||
for rp in overlapping_real_paths:
|
||||
if rp in unet_map:
|
||||
del unet_map[rp]
|
||||
|
||||
merged_map: Dict[str, str] = {}
|
||||
for real_path, original in {**checkpoint_map, **unet_map}.items():
|
||||
if real_path not in merged_map:
|
||||
|
||||
Reference in New Issue
Block a user