-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Auto-enable grouped MoE on loaded / PEFT'd models via loader hook #6727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
f9d010d
c0bc6ef
51f07a6
0085ca4
ef8d27b
ec6fe59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3736,3 +3736,13 @@ def _for_training(m): | |
| from .rl import PatchFastRL | ||
|
|
||
| PatchFastRL(FastLanguageModel = FastLlamaModel) | ||
|
|
||
|
|
||
| # Auto-enable grouped-GEMM MoE (transformers<5 ModuleList experts) on built / PEFT'd | ||
| # models. Wraps the loader leaves once; guarded so it never breaks model loading. | ||
| try: | ||
| from unsloth_zoo.temporary_patches.moe_grouped_modulelist import wrap_loader_for_grouped_moe | ||
| FastLlamaModel.from_pretrained = staticmethod(wrap_loader_for_grouped_moe(FastLlamaModel.from_pretrained)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| FastLlamaModel.get_peft_model = staticmethod(wrap_loader_for_grouped_moe(FastLlamaModel.get_peft_model)) | ||
| except Exception: | ||
| pass | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In normal installs using the declared
unsloth_zoo>=2026.6.7dependency, this module path does not resolve, and the broadexceptsilently skips the whole wrapping block. That means transformers<5 ModuleList MoE models loaded through this path (and the matchingvision.pyblock) keep using the old expert-loop implementation instead of the intended grouped-GEMM patch, so the new auto-enable behavior is effectively a no-op unless users happen to have an unpublished zoo build.Useful? React with 👍 / 👎.