-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
quantize: Handle user-defined quantization levels for additional tensors #12511
base: master
Are you sure you want to change the base?
Conversation
That's an excellent idea! and it'll allow to add all supported tensor types (50+) without creating a mess of parameters. Plus, it will give me something to do over the weekend 😆 |
Yeah, I think this is definitely the way to go - the regex support of that PR gives really good flexibility. |
Adding the regex matching would be a relatively straightforward change, and happy to do it, but wanted to check how useful the feature would really be. @slaren's use case is about choosing which tensors and/or which layers get processed where. For example, the user could opt to run all expert tensors in CPU and the shared experts in the GPU, like so: In my use case, I had assumed the user would want to choose which tensors get quantized at which level, excluding the ones already handled by the program (--leave-output-tensor, --output-tensor-type, --token-embedding-type and --pure), with said quantization applied to the selected tensor/s across all layers. The changes I have just pushed implement exactly that, but with @max-krasnyansky suggestion. A couple of things to note:
Having said that, @jukofyork raises an interesting possibility reminiscing of Razvan-Gabriel Dumitru et al Layer-Wise Quantization and Binrui Zeng et al Layer-Specific Adaptive Quantization. I think is worth exploring further, but suspect the amount of testing to ensure nothing gets broken will be significant. Either way, one for another weekend 😁 In the meantime, will keep 🤞 for this PR to be merged. |
This PR adds the ability to quantize other tensors, beyond token-embedding and output-tensor. It handles most of the supported architectures.
except Mamba, RWKV6, RWKV6QWEN2 and T5 to avoid having too many command options, but can add as well if maintainers request it.For full background on the PR, please see: Squeezing Tensor Bits: the quest for smaller LLMs