-
Notifications
You must be signed in to change notification settings - Fork 31.4k
Attention Quantization with FBGemm & TP #37384
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b3e08ec
fix
MekkCyber 634c9c6
keep fused
MekkCyber 47799fe
Merge branch 'main' into fix_fbgemm_tp
MekkCyber 37c5358
contiguous
MekkCyber 84873cd
rm print
MekkCyber fd7e309
Merge branch 'main' into fix_fbgemm_tp
MekkCyber 06aec7f
Merge branch 'main' into fix_fbgemm_tp
MekkCyber 1c166f3
update
MekkCyber 1f1bab8
update
MekkCyber 4333431
rm print
MekkCyber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -241,6 +241,37 @@ def update_missing_keys(self, model, missing_keys: List[str], prefix: str) -> Li | |
| not_missing_keys.append(missing) | ||
| return [k for k in missing_keys if k not in not_missing_keys] | ||
|
|
||
| def update_tp_plan(self, config): | ||
| additional_text_plan = { | ||
MekkCyber marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "layers.*.self_attn.q_proj.weight": "local_colwise", | ||
| "layers.*.self_attn.q_proj.weight_scale": "local_colwise", | ||
| "layers.*.self_attn.k_proj.weight": "local_colwise", | ||
| "layers.*.self_attn.k_proj.weight_scale": "local_colwise", | ||
| "layers.*.self_attn.v_proj.weight": "local_colwise", | ||
| "layers.*.self_attn.v_proj.weight_scale": "local_colwise", | ||
| "layers.*.self_attn.o_proj.weight": "local_rowwise", | ||
| "layers.*.self_attn": "gather", | ||
| "layers.*.input_layernorm.weight": "sequence_parallel", | ||
| "layers.*.post_attention_layernorm.weight": "sequence_parallel", | ||
| "norm.weight": "sequence_parallel", | ||
| "layers.*.feed_forward.shared_expert.gate_proj.weight": "local_colwise", | ||
| "layers.*.feed_forward.shared_expert.gate_proj.weight_scale": "local_colwise", | ||
| "layers.*.feed_forward.shared_expert.up_proj.weight": "local_colwise", | ||
| "layers.*.feed_forward.shared_expert.up_proj.weight_scale": "local_colwise", | ||
| "layers.*.feed_forward.shared_expert.down_proj.weight": "local_rowwise", | ||
| "layers.*.feed_forward.experts": "local", | ||
| "layers.*.feed_forward": "gather", | ||
| "layers.*.feed_forward.experts.*.gate_proj.weight": "local_colwise", | ||
| "layers.*.feed_forward.experts.*.gate_proj.weight_scale": "local_colwise", | ||
| "layers.*.feed_forward.experts.*.up_proj.weight": "local_colwise", | ||
| "layers.*.feed_forward.experts.*.up_proj.weight_scale": "local_colwise", | ||
|
||
| "layers.*.feed_forward.experts.*.down_proj.weight": "local_rowwise", | ||
| } | ||
| if config.get_text_config() is not None and config.get_text_config().base_model_tp_plan is not None: | ||
| config.get_text_config().base_model_tp_plan = additional_text_plan | ||
MekkCyber marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| return config | ||
|
|
||
| def is_serializable(self, safe_serialization=None): | ||
| return True | ||
|
|
||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.