fix AssertionError: Original QKV code not found#3657
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughRemoves Gemma4 from QKV source-rewrite patches, makes ChangesGemma4 LoRA handling changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
| # NOTE: Gemma4 intentionally has no QKV_PATCHES entry. It always runs | ||
| # through the fused attention monkeypatch (patch_gemma4_fused_attn), | ||
| # whose hand-written forward already calls self.apply_qkv/self.apply_o. | ||
| # patch_self_attn_lora skips Gemma4 by class, so a source-rewrite pattern | ||
| # here would be permanently dead. See that skip for the rationale. |
There was a problem hiding this comment.
I don't think this is correct, it's only when we setup that patch, right?
There was a problem hiding this comment.
ok agreed it was misleading it's not specific to Gemma4 ,ig it holds because patch_manager applies patch_gemma4_fused_attn unconditionally for gemma4 before patch_self_attn_lora runs, corrected the comment 🫡
Description
when training Gemma 4 with LoRA. The Gemma 4 fused RMSNorm+RoPE monkeypatch replaces Gemma4TextAttention.forward wholesale before the LoRA QKV/O source-rewrite patch runs, so the rewrite can no longer find its expected pattern and asserts.
Motivation and Context
#3655
How has this been tested?
config runs without AssertionError: Original QKV code not found
AI Usage Disclaimer
claude dignose
Summary by CodeRabbit