fix: Make Recipe.model_dump() output compatible with model_validate()#1328
fix: Make Recipe.model_dump() output compatible with model_validate()#1328dsikka merged 10 commits intovllm-project:mainfrom
Conversation
brian-dellabetta
left a comment
There was a problem hiding this comment.
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
dsikka
left a comment
There was a problem hiding this comment.
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 : ) |
dsikka
left a comment
There was a problem hiding this comment.
Thank you!
Do you mind addressing the quality failures? https://github.com/vllm-project/llm-compressor/actions/runs/14425964874/job/40461747095?pr=1328
|
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 <rtuli@redhat.com> Co-authored-by: Dipika Sikka <dipikasikka1@gmail.com> Co-authored-by: Kyle Sayers <kylesayrs@gmail.com> Co-authored-by: Rahul Tuli <rtuli@redhat.com>
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