Skip to content

Conversation

@n1ck-guo
Copy link
Contributor

Refactored the format and export code, using format to drive export behavior and simplifying the corresponding code.

Signed-off-by: n1ck-guo <heng.guo@intel.com>
Copy link
Contributor

Copilot AI left a 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 OutputFormat to an ABC with abstract methods for pack_layer and save_quantized
  • Removed the export registration system (auto_round/export/register.py and related code in __init__.py)
  • Refactored export functions to accept explicit parameters instead of **kwargs with dictionary unpacking
  • Updated BaseCompressor.save_quantized to 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.

Copy link
Contributor

Copilot AI left a 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>
Signed-off-by: n1ck-guo <heng.guo@intel.com>
Signed-off-by: n1ck-guo <heng.guo@intel.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