-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: upgrade to new fastapi, update models to handle both pydantic v… #3374
feat: upgrade to new fastapi, update models to handle both pydantic v… #3374
Conversation
@timothyjlaurent Can you help rebase the PR and sign off the commits ? |
0a91ff7
to
0c51215
Compare
@sivanantha321 I've rebased and signed all the commits, can you take another look? |
8d3ab1b
to
4531590
Compare
…dependencies Signed-off-by: Timothy Laurent <[email protected]>
4531590
to
3c48864
Compare
@yuzisun Can you help trigger the tests ? |
Signed-off-by: Timothy Laurent <[email protected]>
We had a small bug in the last test and then I somehow borked my rebase -- I've cleaned up the commits on a fresh branch and think it should pass now. |
@timothyjlaurent I don't see a updated version of pydantic in poetry.lock file ? I think we can upgrade the pydantic version to >2.0.0 for model servers. |
@sivanantha321 Ah this is because we hack/python-release runs with --no-update and the sdk is compatible with pydantic v1 or v2. I can either run it to update all packages, or I could add pydantic as an explicit dep to each model server. What do you think? |
You can update the packages as long as it does not breaks anything |
Signed-off-by: Timothy Laurent <[email protected]>
@sivanantha321 I've updated the deps. |
@timothyjlaurent Thanks for upgrading pydantic! Can you help take a look a look at the testing failures? |
I took the time to figure out how to properly run the test suite locally -- needs to be done from the ./python directory. I've updated the tests one notable workaround is that the RayServe test asserted |
assert resp.content == b'{"name":"TestModel","ready":"True"}' | ||
# for some reason the RayServer responds with the stringified python bool | ||
# when run on pydantic < 2 and the bool when run on pydantic >= 2 | ||
# eg {"name":"TestModel","ready":"True"} vs {"name":"TestModel","ready":true} |
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.
I think it is a different bug altogether. Before moving to fastapi, it seems the health handler returned bool values,
but after the migration it started returning string values because how the type is defined ?
@yuzisun
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.
The code seems to be returning bool, as @timothyjlaurent mentioned the issue is for the rayserve case?
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.
This is for the RayServe case.
In the previous assertion with pydantic v1 - we were getting {"name":"TestModel","ready":"True"}
the string value, and testing for that. Seems like it was a bug that got "blessed" by enshrinining it in a testcase.
With the pyanticv2 we're (correctly) getting a bool value for the ready
key (not a stringified python string) - This, I believe is the correct behavior we should expect.
@timothyjlaurent seems like it keeps failing after updating the poetry lock file |
Signed-off-by: Dan Sun <[email protected]>
Signed-off-by: Dan Sun <[email protected]>
Tests passed, Thanks @timothyjlaurent for the great work! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: timothyjlaurent, yuzisun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
kserve#3374) * feat: add support for pydantic v2, tests for pydantic v1, and update dependencies Signed-off-by: Timothy Laurent <[email protected]> * feat: regenerate lock files Signed-off-by: Timothy Laurent <[email protected]> * feat: regenerate lock files with updates Signed-off-by: Timothy Laurent <[email protected]> * fix: update dependencies, fix broken tests * feat: add special case for testing model ready, "True" for pydantic v1 * Update poetry lock Signed-off-by: Dan Sun <[email protected]> --------- Signed-off-by: Timothy Laurent <[email protected]> Signed-off-by: Dan Sun <[email protected]> Co-authored-by: Dan Sun <[email protected]> Signed-off-by: tjandy98 <[email protected]>
kserve#3374) * feat: add support for pydantic v2, tests for pydantic v1, and update dependencies Signed-off-by: Timothy Laurent <[email protected]> * feat: regenerate lock files Signed-off-by: Timothy Laurent <[email protected]> * feat: regenerate lock files with updates Signed-off-by: Timothy Laurent <[email protected]> * fix: update dependencies, fix broken tests * feat: add special case for testing model ready, "True" for pydantic v1 * Update poetry lock Signed-off-by: Dan Sun <[email protected]> --------- Signed-off-by: Timothy Laurent <[email protected]> Signed-off-by: Dan Sun <[email protected]> Co-authored-by: Dan Sun <[email protected]>
kserve#3374) * feat: add support for pydantic v2, tests for pydantic v1, and update dependencies Signed-off-by: Timothy Laurent <[email protected]> * feat: regenerate lock files Signed-off-by: Timothy Laurent <[email protected]> * feat: regenerate lock files with updates Signed-off-by: Timothy Laurent <[email protected]> * fix: update dependencies, fix broken tests * feat: add special case for testing model ready, "True" for pydantic v1 * Update poetry lock Signed-off-by: Dan Sun <[email protected]> --------- Signed-off-by: Timothy Laurent <[email protected]> Signed-off-by: Dan Sun <[email protected]> Co-authored-by: Dan Sun <[email protected]> Signed-off-by: Curtis Maddalozzo <[email protected]>
* feat: upgrade to new fastapi, update models to handle both pydantic v… (#3374) * feat: add support for pydantic v2, tests for pydantic v1, and update dependencies Signed-off-by: Timothy Laurent <[email protected]> * feat: regenerate lock files Signed-off-by: Timothy Laurent <[email protected]> * feat: regenerate lock files with updates Signed-off-by: Timothy Laurent <[email protected]> * fix: update dependencies, fix broken tests * feat: add special case for testing model ready, "True" for pydantic v1 * Update poetry lock Signed-off-by: Dan Sun <[email protected]> --------- Signed-off-by: Timothy Laurent <[email protected]> Signed-off-by: Dan Sun <[email protected]> Co-authored-by: Dan Sun <[email protected]> Signed-off-by: Curtis Maddalozzo <[email protected]> * Remove python 3.8 --------- Signed-off-by: Timothy Laurent <[email protected]> Signed-off-by: Dan Sun <[email protected]> Signed-off-by: Curtis Maddalozzo <[email protected]> Co-authored-by: Timothy J Laurent <[email protected]> Co-authored-by: Dan Sun <[email protected]>
Bump kserve to 0.12.1 that includes the following fixes we need: * support for pydantic v2 (kserve/kserve#3374) which is used by knowledge_integrity v0.6 * fix for ray serve compatibility issue (kserve/kserve#3556). Bug: T363127 Change-Id: I3fd7c5963c647ab1f407f21c4bd9e2b530fe8a47
Bump kserve to 0.12.1 that includes the following fixes we need: * support for pydantic v2 (kserve/kserve#3374) which is used by knowledge_integrity v0.6 * fix for ray serve compatibility issue (kserve/kserve#3556). Bug: T363129 Change-Id: I6a4babe2155b0638beb83a0a03af99ef396a666b
Bump kserve to 0.12.1 that includes the following fixes we need: * support for pydantic v2 (kserve/kserve#3374) which is used by knowledge_integrity v0.6 * fix for ray serve compatibility issue (kserve/kserve#3556). Bug: T363130 Change-Id: I9b13d5235b2c52cc71d92db19fe3adc7cdafea1a
…1 an v2, add matrix conditions for pydantic_v1 and pydantic_v2
What this PR does / why we need it:
This work builds on this PR #3273 that adds pydantic 2 support to the kserve package.
The following is copied from that PR:
*Overwrites protected_namespace in pydantic v2 to get rid of warning logs about namespace conflicts in pydantic ref. An example is shown as follows
In addition to handling those incompatibilities it also allows for both pydantic 1.x and 2.x versions.
To accomplish this:
is_pydantic_2
flag is used to change the underlying pydantic implementationsConfig
class in retains the class if it is pydantic 1 and uses themodel_config
syntax if it is pydantic 2. Keys are changed where needed, egschema_extra
->json_schema_extra
.protected_namespace=()
is set on theInferenceResponse
modelpydantic-version
is added to CI. As the default version will be pydantic 2, in the case that the version ispydantic_1
then the make targetinstall_pydantic_1
is executed which downgrades pydantic to v1.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #3373
Type of changes
Please delete options that are not relevant.
Feature/Issue validation/testing:
Please describe the tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.
Added matrix to test both pydantic 1 and pydantic 2
Logs
Special notes for your reviewer:
Checklist:
Release note: