- Notifications
You must be signed in to change notification settings - Fork 636
Fix Pydantic v1 incompatibility #1622
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
3d36817 to 338e7f8 Compare | @mattt I tried this approach but it didn't work, which is why I went all in on vendoring. Although in my tests Pydantic was still pinned at <2, but I replaced all imports with the try..catch v1 thing. When I ran it on a model that installed Pydantic 2 it still failed. It might work when Pydantic isn't pinned but it's worth trying to build Cog models that include pydantic~=1 and pydantic~=2 on top of these changes, to make sure it still works. |
| @andreasjansson Do you recall what errors you saw? It'd be great to have a minimal example that reproduces this problem. |
338e7f8 to 4e0e640 Compare | Digging into this some more, I found this discussion and this issue about problems arising from FastAPI >= 0.100.0 attempting to load v2 Pydantic when the v1 shim is loaded. From there, I found this PR which makes the necessary changes to get all of that working. I forked the repo for that PR to replicate/fastapi, rebased against official FastAPI, and updated this PR to use fastapi from our fork. |
0895c21 to 52546b1 Compare | I got tests passing locally (aside from hypothesis timeouts and flakes), but can't resolve failures in CI. requirements.txtUpgrading to Pydantic 2 is a much easier task (#1625), and we should probably go with that. The hard part is figuring out compatibility with models built using older versions of Cog. |
| @mattt Yes the FastAPI issue is the same thing I ran into. When I realized we'd have to rely on a fork of FastAPI I went down the vendoring route. I've had pretty good success with I'd also love to understand why vendoring is a bad idea. |
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
…PredictionRequest and None have no overlap Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
52546b1 to 6806ca6 Compare
Related to #1384