Files
ethanfel-ComfyUI-LoRA-Optim…/__init__.py
EthanfelandClaude Sonnet 4.6 04442c3ce2 fix: compress LoRAAdapter patches in SaveMergedLoRA when save_rank is set
The fast linear merge path (_build_exact_linear_patch) produces LoRAAdapters
with rank = sum of all input ranks. SaveMergedLoRA was extracting these
weights directly without applying any SVD compression, making save_rank and
patch_compression settings ineffective for weighted_sum/weighted_average merges.

Fix: compress LoRAAdapter patches when current_rank > target_rank (where
target = save_rank when explicit, or fallback_rank in auto mode). Skip
LoCon patches (mid != None) which require special reshape handling.

Also improve auto-mode logging to explain rank growth (n_loras × avg_rank)
and direct users to set save_rank explicitly to control output file size.

Fix test discovery: __init__.py relative import fails when pytest imports it
as a standalone module. Guard with try/except to prevent all tests from
failing during collection/setup. Add pyproject.toml pytest config and
conftest.py to configure test discovery.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 14:17:40 +02:00

12 lines
349 B
Python

"""ComfyUI-LoRA-Optimizer — auto-optimizer for multi-LoRA merging."""
try:
from .lora_optimizer import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
except ImportError:
NODE_CLASS_MAPPINGS = {}
NODE_DISPLAY_NAME_MAPPINGS = {}
WEB_DIRECTORY = "./js"
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]