-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add fused QKV for other bitnet models #6
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
feat: add fused QKV for other bitnet models #6
Conversation
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.
I thought about making it configurable. But I think we can just keep it fused for bitnet because of the increased performance.
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.
Makes sense, let's put it to True always then
mlx_lm/quant/utils.py
Outdated
|
|
||
|
|
||
| def apply_hf_quantization(model, config): | ||
| def apply_hf_quantization(model, config, weights): |
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.
Please ensure the tests bitnet_llama tests are passing. Because I use this function there
Blaizzy
left a comment
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 is awesome!
I just have a couple nits.
mlx_lm/models/bitlinear_layers.py
Outdated
| print(f"{name:<16}: {dt*1e3:.1f} ms | {(bs*sl)/dt:,.0f} tok/s") | ||
|
|
||
|
|
||
| class BitFusedAttention(nn.Module): |
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.
Let's also import this module on bitnet.py to avoid having duplicates.
|
Addressed all comments ! LMK wdyt |
@Blaizzy