-
Notifications
You must be signed in to change notification settings - Fork 376
Fix Llama4 example #2846
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?
Fix Llama4 example #2846
Conversation
Signed-off-by: yiliu30 <yi4.liu@intel.com>
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/2846
Note: Links to docs will display an error until the docs builds have been completed. ❌ 9 New Failures, 1 Cancelled JobAs of commit c6fdc2c with merge base df7bf37 ( NEW FAILURES - The following jobs have failed:
CANCELLED JOB - The following job was cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| batch_size = x.shape[0] | ||
| x = x.view(-1, self.hidden_dim) # x: [T, D] | ||
| scores = self.router(x) # [T, E] | ||
| scores = self.router(x)[0] # [T, E] |
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.
The original router returns router_scores and router_logits.
https://github.com/huggingface/transformers/blob/19ffe0219dae122203f9726669f88ef1c6ea3bb4/src/transformers/models/llama4/modeling_llama4.py#L143
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.
router here is a nn.Linear, not Llama4Router actually, see L21?
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.
This rounter was replaced with the original rounter.
ao/torchao/prototype/moe_quant/llama4_quant.py
Lines 48 to 53 in 9d01b43
| router = module.router | |
| up_proj = module.experts.gate_up_proj | |
| w1, w3 = up_proj.permute(0, 2, 1).chunk(2, dim=1) | |
| w2 = module.experts.down_proj.permute(0, 2, 1) | |
| new_mod.router = router |
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.
so this module does not run by itself? seems quite confusing
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.
The MOEFeedForwardAOQuantizable was used, but it seems that its rounter shouldn’t be quantized in order to preserve accuracy. Could you confirm that? @HDCharles
|
Hi @liangel-02 @andrewor14 Looks like the failed CI checks are not related to this PR. Could you help retrigger them? |
No description provided.