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

Quantization Compressor Support #45

Merged
merged 14 commits into from
May 3, 2024
Merged

Conversation

Satrat
Copy link

@Satrat Satrat commented Apr 30, 2024

  • Renamed CompressionConfig to SparsityCompressionConfig, QuantizationConfig is quantized version
  • Renamed ModelCompressor -> Compressor. This class still represents a single compression algorithm, either for sparsity or quantization. The "dense" compressor also applies to a model that has been quantized but not compressed
  • ModelCompressor is now a new class that handles the overall compression and decompression of both sparsity and quantization. Its responsible for model loading/saving as well as config loading/saving
  • Added new IntCompressor to represent a quantized model that has been compressed to its quantized type (ie float32 -> int8)

Works with this SparseML PR: neuralmagic/sparseml#2260

@Satrat Satrat marked this pull request as ready for review May 1, 2024 14:14
tests/test_utils/test_helpers.py Show resolved Hide resolved
from compressed_tensors.base import SPARSITY_CONFIG_NAME
from compressed_tensors.config import CompressionConfig
from compressed_tensors.config import SparsityCompressionConfig
from compressed_tensors.quantization import QuantizationConfig
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: shouldn't all configs live side-by-side? the principle of least surprise?

src/compressed_tensors/compressors/model_compressor.py Outdated Show resolved Hide resolved
@Satrat Satrat merged commit df94b5e into compressed-lifecycle May 3, 2024
@Satrat Satrat deleted the quant_compressor branch May 3, 2024 18:07
Satrat pushed a commit that referenced this pull request May 7, 2024
* Compressed lifecycle implementation (INT8 only)

* Apply suggestions from code review

* small fixes for runtime

* Quantization Compressor Support (#45)

* add classes

* WIP

* moving around classes

* code complete

* tests passing

* unit test bugs

* fill out int decompression

* docstrings

* allow repeat frozens

* int compressor unit tests

* PR comments

* fix device issue

* fixing leaf checker

* initial commit

* Revert "Merge branch 'main' into compressed-lifecycle"

This reverts commit 8dcdde5, reversing
changes made to bb36936.

* update version

* fix test

---------

Co-authored-by: Sara Adkins <sara@neuralmagic.com>
Co-authored-by: dbogunowicz <damian@neuralmagic.com>
Satrat pushed a commit that referenced this pull request May 15, 2024
* group size

* add logic in base observer

* Compressed lifecycle implementation (INT8 only)

* group size full lifecycle run

* Apply suggestions from code review

* before vectorize the for loop

* comments, todo add channelwise

* chan wise impl

* comments

* fix channel wise

* comments, validators

* fix typo

* small fixes for runtime

* add classes

* tensor return error fix

* WIP

* moving around classes

* fix sparseml-side of code and add per channel

* pyndatic defaults

* token wise quant

* Update src/compressed_tensors/quantization/quant_args.py

Co-authored-by: Benjamin Fineran <bfineran@users.noreply.github.com>

* comments'

* code complete

* tests passing

* unit test bugs

* fill out int decompression

* docstrings

* allow repeat frozens

* update dim

* int compressor unit tests

* move helper

* shape consistency

* initial commit

* first unit test passing

* Update src/compressed_tensors/quantization/lifecycle/forward.py

Co-authored-by: Benjamin Fineran <bfineran@users.noreply.github.com>

* comments

* tests passing

* one more test

* cleanup

* pass test_quant_args

* Quantization Compressor Support (#45)

* add classes

* WIP

* moving around classes

* code complete

* tests passing

* unit test bugs

* fill out int decompression

* docstrings

* allow repeat frozens

* int compressor unit tests

* PR comments

* fix device issue

* fixing leaf checker

* updating tests

* docstrings

* updating examples

* update examples

* fix channelwise

* new tests, some fail

* WIP

* new helper fn

* actually just a warning

* group size speedups + fixes

* group compression

* fix output type on decompress

* fix channelwise

* revert

* more tests

* move tests

* example notebook

* add example notebook

* update README

* cleanup

---------

Co-authored-by: George Ohashi <george@neuralmagic.com>
Co-authored-by: Benjamin <ben@neuralmagic.com>
Co-authored-by: Benjamin Fineran <bfineran@users.noreply.github.com>
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.

2 participants