Skip to content
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

Align vocab_size to 32-multiples to Prevent Shape Mismatch Errors on Ampere GPUs with bnb Quantization #172

Open
hjh0119 opened this issue May 14, 2024 · 0 comments

Comments

@hjh0119
Copy link
Contributor

hjh0119 commented May 14, 2024

As mentioned in #129

It is recommended to set the tokenizer's vocab_size to be a multiple of 32 (and consequently adjust the dimensions of the embedding and the final lm_head, i.e., the language_model.output accordingly). Otherwise, after quantization with bitsandbytes (bnb), the model may encounter errors when computing gradients (backward) on Ampere GPUs with a version greater than 8. This is due to bnb manually padding the shape to the nearest multiple of 32, leading to shape mismatches.

https://github.com/TimDettmers/bitsandbytes/blob/main/bitsandbytes/functional.py#L508-L512

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant