Repository navigation
FIX get_delta_weight for pointwise Conv3d layers in LoRA and HiRA - #3777
Merged
BenjaminBossan merged 1 commit intoSep 21, 2026
Merged
BenjaminBossan merged 1 commit into
BenjaminBossan merged 1 commit into
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
BenjaminBossan
approved these changes
Sep 21, 2026
BenjaminBossan
left a comment
Member
There was a problem hiding this comment.
Thanks for fixing this issue and adding a new test case for this, LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #3768
_ConvNd.get_delta_weightin LoRA and HiRA takes the conv2d 1x1 shortcut whenweight.size()[2:4] == (1, 1). That is also true for aConv3dweight withkernel_size=1or(1, 1, k), thesqueeze(3).squeeze(2)in the shortcut then leaves the kernel dim in place and the matmul fails. For LoRA this breaksmerge_adapter(),merge_and_unload()andadd_weighted_adapter(), HiRA fails already inforwardbecause it builds the forward pass fromget_delta_weight.The check now compares the whole kernel shape,
weight.shape[2:] == (1, 1), so only a 4D 1x1 weight takes the shortcut andConv3dlayers go through the existingconv_fnpath, which handles them correctly. Nothing changes for layers that worked before.Tests: a pointwise
Conv3d1x1model is added toTEST_CASESintests/test_custom_models.pyfor LoRA, LoRA with DoRA and HiRA. Onmain45 of its 168 tests fail (all merge related tests for LoRA, the forward tests for HiRA), with this change 162 pass and 6 are skipped (the usual bf16 skips).pytest tests/test_custom_models.py -k "1x1 or Conv3d": 907 passed, 47 skipped.make styleclean with ruff 0.16.4.AI disclosure: I used an AI coding agent to help write this patch, the tests and this description. I have read the change and the tests myself and I will answer review comments personally.