ComfyUI/comfy/weight_adapter
easonysliu e5f6c1ff68 fix: reshape dora_scale before broadcasting in weight_decompose
In weight_decompose(), the 1D dora_scale tensor [N] divided by the
multi-dimensional weight_norm [N, 1, ...] would incorrectly broadcast
to [N, N, ...] (outer-product shape) instead of element-wise [N, 1, ...].

This caused shape mismatches when applying DoRA to non-square weight
matrices (e.g. MLP layers where d_ff != d_model), while silently
producing correct results for square weights (most attention Q/K/V/O).

Fix: explicitly reshape dora_scale to match weight_norm's dimensionality
before the division.

Fixes #12938

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
2026-03-17 11:17:57 +08:00
..
__init__.py [Weight-adapter/Trainer] Bypass forward mode in Weight adapter system (#11958) 2026-01-24 22:56:22 -05:00
base.py fix: reshape dora_scale before broadcasting in weight_decompose 2026-03-17 11:17:57 +08:00
boft.py [Weight-adapter/Trainer] Bypass forward mode in Weight adapter system (#11958) 2026-01-24 22:56:22 -05:00
bypass.py [Trainer] training with proper offloading (#12189) 2026-02-10 21:45:19 -05:00
glora.py [Weight-adapter/Trainer] Bypass forward mode in Weight adapter system (#11958) 2026-01-24 22:56:22 -05:00
loha.py [Weight-adapter/Trainer] Bypass forward mode in Weight adapter system (#11958) 2026-01-24 22:56:22 -05:00
lokr.py [Weight-adapter/Trainer] Bypass forward mode in Weight adapter system (#11958) 2026-01-24 22:56:22 -05:00
lora.py MPDynamic: force load flux img_in weight (Fixes flux1 canny+depth lora crash) (#12446) 2026-02-15 20:30:09 -05:00
oft.py [Weight-adapter/Trainer] Bypass forward mode in Weight adapter system (#11958) 2026-01-24 22:56:22 -05:00