-
Notifications
You must be signed in to change notification settings - Fork 216
fix: Make Recipe.model_dump() output compatible with model_validate() #1328
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
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.
Hi @ved1beta , thanks for the contribution! We should add some unit tests to make sure the recipes you checked manually get added to our CI tests. I can do this tomorrow, or if you have them handy still please add them to tests/llmcompressor/recipe/test_recipe.py
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.
Looks good! Nice job
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.
Thank you for your PR!
Would you mind addressing the Quality Checks? You can install the required packages using the dev
install and then running make style
under the root directory.
Also, could you add the tests that you used to verify the changes? Thank you!
hey @dsikka made the changes please have look : ) |
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.
Thank you!
Do you mind addressing the quality failures? https://github.com/vllm-project/llm-compressor/actions/runs/14425964874/job/40461747095?pr=1328
Signed-off-by: Rahul Tuli <[email protected]>
Pushed Style Fixes; + merged main! |
This PR reverts commit 998be99 which was merged prematurely. The required base tests were skipped during the original review process. When these tests eventually ran on the main branch, they revealed a failure: https://github.com/vllm-project/llm-compressor/actions/runs/14628792870/job/41046641641 The original PR #1328 has been reopened to address the identified issues before resubmitting.
…#1328) SUMMARY: Fixed issue #1319 where Recipe.model_dump() output couldn't be used with Recipe.model_validate(). Implemented an override of the model_dump() method to ensure it produces output in the format expected by validation, enabling proper round-trip serialization using standard Pydantic methods. TEST PLAN: Created test cases to verify fix works with both simple and complex recipes Confirmed Recipe.model_validate(recipe.model_dump()) succeeds with various recipe formats Validated that recipes with multiple stages having the same group name serialize/deserialize correctly Ensured existing YAML serialization pathways continue to work as expected --------- Signed-off-by: Rahul Tuli <[email protected]> Co-authored-by: Dipika Sikka <[email protected]> Co-authored-by: Kyle Sayers <[email protected]> Co-authored-by: Rahul Tuli <[email protected]>
This PR reverts commit 998be99 which was merged prematurely. The required base tests were skipped during the original review process. When these tests eventually ran on the main branch, they revealed a failure: https://github.com/vllm-project/llm-compressor/actions/runs/14628792870/job/41046641641 The original PR #1328 has been reopened to address the identified issues before resubmitting.
SUMMARY:
Fixed issue #1319 where Recipe.model_dump() output couldn't be used with Recipe.model_validate(). Implemented an override of the model_dump() method to ensure it produces output in the format expected by validation, enabling proper round-trip serialization using standard Pydantic methods.
TEST PLAN:
Created test cases to verify fix works with both simple and complex recipes
Confirmed Recipe.model_validate(recipe.model_dump()) succeeds with various recipe formats
Validated that recipes with multiple stages having the same group name serialize/deserialize correctly
Ensured existing YAML serialization pathways continue to work as expected