-
Notifications
You must be signed in to change notification settings - Fork 571
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
Update to Pydantic 2 and FastAPI 0.100.0 #1186
Comments
Cross-linking this comment from the dependabot PR so we don't lose it: #1187 (comment) |
Related to #1216 |
Until this is implemented, this prevents use of packages (e.g. https://github.com/outlines-dev/outlines) that have dependencies on pydantic and have upgraded to v2 in their most recent updates. Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/local/lib/python3.11/site-packages/cog/server/http.py", line 16, in <module>
from fastapi import Body, FastAPI, Header, HTTPException, Path, Response
File "/usr/local/lib/python3.11/site-packages/fastapi/__init__.py", line 7, in <module>
from .applications import FastAPI as FastAPI
File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 16, in <module>
from fastapi import routing
File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 22, in <module>
from fastapi import params
File "/usr/local/lib/python3.11/site-packages/fastapi/params.py", line 4, in <module>
from pydantic.fields import FieldInfo, Undefined
ImportError: cannot import name 'Undefined' from 'pydantic.fields' (/usr/local/lib/python3.11/site-packages/pydantic/fields.py)
ⅹ Failed to get container status: exit status 1 |
really need it ,specially when some llm inference engine requires pydantic 2.... |
@sinopec - could you give model examples for testing? |
I deployed a model today that required pydantic==2.5.3. While we're waiting for the update to newer versions of pydantic and fastAPI, here are some possible workarounds. Choose one depending on the speed you require and how tightly integrated your code is with the incompatible versions of pydantic and fastAPI: Supplemental venvCreate a virtual environment with venv to supplement the packages installed from
predict.py:
Drawback: You can't easily pre-load your modelweights in Poetry
in predict.py:
Drawback: You can't easily pre-load your modelweights in Monkeypatching
This hack works best if the pydantic/fastAPI modules are imported but not essential for your code. The advantage is that you can use setup() to preload model weights. |
Summarizing here:
cc @nickstenning for the sponsorship |
I chatted to @yorickvP on Slack. Here's a quick summary of what we talked about:
|
This PR vendors all Python packages using the [vendoring](https://pypi.org/project/vendoring/) library. Vendoring allows users to install packages that rely on versions of libraries that are in conflict with Cog's dependencies (e.g. Pydantic, see replicate#1562, replicate#1384, replicate#1186, replicate#1586, replicate#1336, replicate#785). This PR is broken up into two commits: First one adds all the files in the `_vendor` directory, second one is the actually changed code. Closes replicate#409 Signed-off-by: andreasjansson <[email protected]>
This PR vendors all Python packages using the [vendoring](https://pypi.org/project/vendoring/) library. Vendoring allows users to install packages that rely on versions of libraries that are in conflict with Cog's dependencies (e.g. Pydantic, see replicate#1562, replicate#1384, replicate#1186, replicate#1586, replicate#1336, replicate#785). This PR is broken up into two commits: First one adds all the files in the `_vendor` directory, second one is the actually changed code. Closes replicate#409 Signed-off-by: andreasjansson <[email protected]>
This PR vendors all Python packages using the [vendoring](https://pypi.org/project/vendoring/) library. Vendoring allows users to install packages that rely on versions of libraries that are in conflict with Cog's dependencies (e.g. Pydantic, see replicate#1562, replicate#1384, replicate#1186, replicate#1586, replicate#1336, replicate#785). Vendored packages are gitignored and are sync'd by the default `make` rule. Closes replicate#409 Signed-off-by: andreasjansson <[email protected]>
This PR vendors all Python packages using the [vendoring](https://pypi.org/project/vendoring/) library. Vendoring allows users to install packages that rely on versions of libraries that are in conflict with Cog's dependencies (e.g. Pydantic, see replicate#1562, replicate#1384, replicate#1186, replicate#1586, replicate#1336, replicate#785). Vendored packages are gitignored and are sync'd by the default `make` rule. Closes replicate#409 Signed-off-by: andreasjansson <[email protected]>
This PR vendors all Python packages using the [vendoring](https://pypi.org/project/vendoring/) library. Vendoring allows users to install packages that rely on versions of libraries that are in conflict with Cog's dependencies (e.g. Pydantic, see replicate#1562, replicate#1384, replicate#1186, replicate#1586, replicate#1336, replicate#785). Vendored packages are gitignored and are sync'd by the default `make` rule. Closes replicate#409 Signed-off-by: andreasjansson <[email protected]>
This PR vendors all Python packages using the [vendoring](https://pypi.org/project/vendoring/) library. Vendoring allows users to install packages that rely on versions of libraries that are in conflict with Cog's dependencies (e.g. Pydantic, see replicate#1562, replicate#1384, replicate#1186, replicate#1586, replicate#1336, replicate#785). Vendored packages are gitignored and are sync'd by the default `make` rule. Closes replicate#409 Signed-off-by: andreasjansson <[email protected]>
This PR vendors all Python packages using the [vendoring](https://pypi.org/project/vendoring/) library. Vendoring allows users to install packages that rely on versions of libraries that are in conflict with Cog's dependencies (e.g. Pydantic, see replicate#1562, replicate#1384, replicate#1186, replicate#1586, replicate#1336, replicate#785). Vendored packages are gitignored and are sync'd by the default `make` rule. Closes replicate#409 Signed-off-by: andreasjansson <[email protected]>
This PR vendors all Python packages using the [vendoring](https://pypi.org/project/vendoring/) library. Vendoring allows users to install packages that rely on versions of libraries that are in conflict with Cog's dependencies (e.g. Pydantic, see replicate#1562, replicate#1384, replicate#1186, replicate#1586, replicate#1336, replicate#785). Vendored packages are gitignored and are sync'd by the default `make` rule. Closes replicate#409 Signed-off-by: andreasjansson <[email protected]>
This PR vendors all Python packages using the [vendoring](https://pypi.org/project/vendoring/) library. Vendoring allows users to install packages that rely on versions of libraries that are in conflict with Cog's dependencies (e.g. Pydantic, see replicate#1562, replicate#1384, replicate#1186, replicate#1586, replicate#1336, replicate#785). Vendored packages are gitignored and are sync'd by the default `make` rule. Closes replicate#409 Signed-off-by: andreasjansson <[email protected]>
Same issue wtih pydantic 2, bumping this issue magically expecting to be fixed.. :) |
From https://fastapi.tiangolo.com/release-notes/#01000:
The text was updated successfully, but these errors were encountered: