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

feat: Publish/load pre-quantized models #34

Merged
merged 15 commits into from
Feb 5, 2024
Merged

Conversation

carlosgjs
Copy link
Collaborator

@carlosgjs carlosgjs commented Feb 1, 2024

Running quantized models significantly reduces the GPU memory required for inference. Instead of downloading the full model and quantizing it during the load, we can quantize the model offline and save it. At runtime the (smaller) quantized model can be loaded.

This PR includes 3 changes:

  • Updates to the bitsandbytes and transformers versions which support quantizing
  • A notebook for quantizing and publishing models
  • Logic to map known models to their pre-quantized versions.

Closes #4
Closes #8

@codecov-commenter
Copy link

codecov-commenter commented Feb 1, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (e7c86f5) 97.32% compared to head (c864e8c) 97.85%.

Files Patch % Lines
src/autora/doc/runtime/predict_hf.py 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
+ Coverage   97.32%   97.85%   +0.53%     
==========================================
  Files           5        5              
  Lines         224      233       +9     
==========================================
+ Hits          218      228      +10     
+ Misses          6        5       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@uwcdc uwcdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those were the only 2 things that I had questions about. But I love the updated formatting in the other files.

notebooks/import_model.ipynb Show resolved Hide resolved
notebooks/import_model.ipynb Outdated Show resolved Hide resolved
@carlosgjs carlosgjs requested a review from uwcdc February 2, 2024 19:01
@carlosgjs carlosgjs marked this pull request as ready for review February 2, 2024 19:01
Copy link
Collaborator

@uwcdc uwcdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall good. Just a couple small fixes + a compliment.

notebooks/generate.ipynb Show resolved Hide resolved
notebooks/import_model.ipynb Outdated Show resolved Hide resolved
src/autora/doc/runtime/predict_hf.py Show resolved Hide resolved
Copy link
Collaborator

@uwcdc uwcdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@carlosgjs carlosgjs merged commit 7891902 into main Feb 5, 2024
9 checks passed
@carlosgjs carlosgjs deleted the carlosg/savemodel branch February 5, 2024 23:41
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

Successfully merging this pull request may close these issues.

Support model downloading/caching Save the 4-bit quantized version of the Llama2 7b model in blob storage
3 participants