-
Notifications
You must be signed in to change notification settings - Fork 276
Config serde #1806
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
Closed
Closed
Config serde #1806
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drisspg
added a commit
that referenced
this pull request
Mar 1, 2025
stack-info: PR: #1806, branch: drisspg/stack/41
eb015da
to
0664d5c
Compare
drisspg
added a commit
that referenced
this pull request
Mar 3, 2025
stack-info: PR: #1806, branch: drisspg/stack/41
0664d5c
to
07ae065
Compare
drisspg
added a commit
that referenced
this pull request
Mar 3, 2025
stack-info: PR: #1806, branch: drisspg/stack/41
07ae065
to
b3e2dbd
Compare
drisspg
added a commit
that referenced
this pull request
Mar 3, 2025
stack-info: PR: #1806, branch: drisspg/stack/41
b3e2dbd
to
66debad
Compare
drisspg
added a commit
that referenced
this pull request
Mar 3, 2025
stack-info: PR: #1806, branch: drisspg/stack/41
66debad
to
6b52e33
Compare
drisspg
added a commit
that referenced
this pull request
Mar 4, 2025
stack-info: PR: #1806, branch: drisspg/stack/41
6b52e33
to
e8195fb
Compare
drisspg
added a commit
that referenced
this pull request
Mar 4, 2025
stack-info: PR: #1806, branch: drisspg/stack/41
e8195fb
to
500f84d
Compare
629ebf2
to
ac07aa2
Compare
drisspg
added a commit
that referenced
this pull request
Mar 5, 2025
stack-info: PR: #1806, branch: drisspg/stack/41
ac07aa2
to
fa88916
Compare
drisspg
added a commit
that referenced
this pull request
Mar 5, 2025
stack-info: PR: #1806, branch: drisspg/stack/41
fa88916
to
025d432
Compare
drisspg
added a commit
that referenced
this pull request
Mar 5, 2025
stack-info: PR: #1806, branch: drisspg/stack/41
025d432
to
c4235ad
Compare
drisspg
added a commit
that referenced
this pull request
Mar 5, 2025
stack-info: PR: #1806, branch: drisspg/stack/41
c4235ad
to
8565f48
Compare
drisspg
added a commit
that referenced
this pull request
Mar 5, 2025
stack-info: PR: #1806, branch: drisspg/stack/41
8565f48
to
6dea2e7
Compare
stack-info: PR: #1806, branch: drisspg/stack/41
6dea2e7
to
7f411f7
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
topic: new feature
Use this tag if this PR adds a new feature
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stacked PRs:
Summary: Convert base configs to use Pydantic
Related PRs
Hugging Face: Add option for ao base configs huggingface/transformers#36526
VLLM:
Torchao vllm-project/vllm#14231
Overview
This PR adds serialization and deserialization capabilities to most* of our Config classes by migrating from dataclasses to Pydantic models. The implementation enables JSON serialization/deserialization and dictionary conversion for all quantization configuration classes.
Note that we have two options add this to our depedencies ( we weirdly dont have any specified currently) or I can probably write this in a way to only be enabled if we have the runtime dep>
Testing
Added a new test file
test/quantization/test_config_serialization.py
with tests for alot of configuration classesImpact
W/ this we can serialize configs. However as implemented it also enforces that all params are kwarg only which may BC BREAKING, you can hack around this w/ pydantic but not sure how much of a deal this is yet.
Why do we need this?
I am currently auditing our end to end flow, and while yes the core serialization premise of tensor subclass to both define our data representation and modulate runtime behavior exists - that is not how the rest of the ecosystem is operating.
Currenlty our hugging face integration only supports 4 options:
https://huggingface.co/docs/transformers/main/en/main_classes/quantization#transformers.TorchAoConfig.quant_type
I for 1 want to have this support the full breadth of options and as well I want this to be configurable per layer. I think this gets us closer since we can specify the quant structure in a config.json on the serialized weight.
As well this config.json appears to be reused by VLLm and I am still working on the E2E flow as prototype by Jerry here:
vllm-project/vllm#13588