-
Notifications
You must be signed in to change notification settings - Fork 66
[STEP 2] refactor format and export #1192
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the format and export code by making the OutputFormat class an abstract base class with pack_layer and save_quantized as abstract methods. Each format subclass now implements these methods directly, eliminating the need for separate registration dictionaries (EXPORT_FORMAT and PACKING_LAYER_WITH_FORMAT). This consolidates export logic within format classes, simplifying the codebase and improving maintainability.
Key changes:
- Converted
OutputFormatto an ABC with abstract methods forpack_layerandsave_quantized - Removed the export registration system (
auto_round/export/register.pyand related code in__init__.py) - Refactored export functions to accept explicit parameters instead of
**kwargswith dictionary unpacking - Updated
BaseCompressor.save_quantizedto call format methods directly instead of using the registration dictionary
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| auto_round/formats.py | Converted OutputFormat to ABC, added abstract methods, implemented pack_layer and save_quantized in all format subclasses |
| auto_round/export/utils.py | Added filtering logic to remove callable and unsupported keys from quantization config |
| auto_round/export/register.py | Deleted entire file containing the registration dictionaries |
| auto_round/export/init.py | Removed all registration decorator code |
| auto_round/export/export_to_llmcompressor/export_to_static_fp.py | Refactored to use explicit parameters instead of kwargs unpacking |
| auto_round/export/export_to_llmcompressor/export_to_fp.py | Refactored to use explicit parameters instead of kwargs unpacking |
| auto_round/export/export_to_llmcompressor/export.py | Removed pack_layer function, refactored save_quantized to use explicit parameters |
| auto_round/export/export_to_itrex/export.py | Refactored to use explicit parameters and added processor/image_processor support |
| auto_round/export/export_to_gguf/export.py | Changed vlm parameter to mllm for consistency |
| auto_round/export/export_to_awq/export.py | Refactored to use explicit parameters instead of kwargs unpacking |
| auto_round/export/export_to_autoround/export.py | Removed conditional logic, refactored to use explicit parameters |
| auto_round/export/export_to_autogptq/export.py | Refactored to use explicit parameters instead of kwargs unpacking |
| auto_round/compressors/base.py | Refactored to call format methods directly, defined SERIALIZATION_KEYS constant |
| auto_round/main.py | Added --formats as an alias for --format argument |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Signed-off-by: n1ck-guo <heng.guo@intel.com>
Refactored the format and export code, using format to drive export behavior and simplifying the corresponding code.