Enable using different MoE implementations in GraniteMoE#46526
Open
mbknust wants to merge 2 commits into
Open
Conversation
This means we can switch out the expert module implementation.
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: granitemoe, granitemoehybrid, granitemoeshared |
Contributor
|
View the CircleCI Test Summary for this PR: https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=46526&sha=6f0df7 |
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.
Changes
I've changed
models/granitemoe/modular_granitemoe.py, so that it usesMixtralExpertsandMixtralTopKRouterinstead ofJetMoeParallelExpertsandJetMoeTopKGating. From what I've seen, almost all MoE models have implementations based on Mixtral. SinceMixtralExpertsuses the@use_experts_implementationdecorator, this PR will enable switching out the MoE module implementation inside GraniteMoE as well. The change also affects the two derived architectures:granitemoesharedandgranitemoehybrid.Since Mixtral's parameters have different names, I've had to add some renamings to
src/transformers/conversion_mapping.py.With the new gating module, the original reason for
_can_compile_fullgraph = Falseno longer applies, so I've set it to True, except forgranitemoehybrid, where I've had to keep it False, due to some unrelated problem with that model. I've also set_can_record_outputs.Since one of the MoE implementations that can be chosen is based on the
grouped_mmoperator, which requires that strides be 16-byte aligned, I've changed the model sizes in the test file to be multiples of 8 (see also #42697).Who can review?
@IlyasMoutawwakil