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

Adding support for 8-bit training with bitsandbytes #582

Merged
merged 8 commits into from
Jan 11, 2023

Conversation

mrcabbage972
Copy link
Contributor

@mrcabbage972 mrcabbage972 commented Jan 10, 2023

Adding bitsandbytes dependency to requirements.txt.

Using the currently unused quantization option in the config file to set whether to use the BNB 8-bit optimizer.

Details on using the 8-bit optimizer in HF here and detailed discussion on HF implementation here.

Note the part about forcing the embedding layer to use the 32-bit optimizer. Doing that as suggested in the link above:

For existing pre-trained transformers models one could use them as is and use 8-bit optimizers for all weights, but 32-bit optimizers for the embedding layer.

This override code might require a bit more work if we choose to use a model that has a non-standard embedding layer.

@sanagno
Copy link
Collaborator

sanagno commented Jan 10, 2023

Thanks a lot, looks great! Can you also run the pre-commit for the final commit?

@mrcabbage972
Copy link
Contributor Author

@sanagno Yes, fixed.

@sanagno sanagno merged commit 1c5d44c into LAION-AI:main Jan 11, 2023
sanagno pushed a commit that referenced this pull request Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants