replicate / cog

Containers for machine learning
https://cog.run
Apache License 2.0
7.89k stars 550 forks source link

build hangs on 'Validating model schema...' #1336

Open happy-machine opened 11 months ago

happy-machine commented 11 months ago

With no other feedback?

Thanks

rdcoder33 commented 11 months ago

Seems related, I am getting this:

Traceback (most recent call last): File "/root/.pyenv/versions/3.10.13/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/root/.pyenv/versions/3.10.13/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/cog/command/openapi_schema.py", line 10, in from ..server.http import create_app File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/cog/server/http.py", line 21, in from pydantic.error_wrappers import ErrorWrapper File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pydantic/_migration.py", line 300, in wrapper raise PydanticImportError(f'{import_path} has been removed in V2.') pydantic.errors.PydanticImportError: pydantic.error_wrappers:ErrorWrapper has been removed in V2.

For further information visit https://errors.pydantic.dev/2.4/u/import-error

ⅹ Failed to get type signature: exit status 1

Sanawar21 commented 11 months ago

`Validating model schema...

Traceback (most recent call last): File "/root/.pyenv/versions/3.10.13/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/root/.pyenv/versions/3.10.13/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/cog/command/openapi_schema.py", line 10, in from ..server.http import create_app File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/cog/server/http.py", line 16, in from fastapi import Body, FastAPI, Header, HTTPException, Path, Response File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/fastapi/init.py", line 7, in from .applications import FastAPI as FastAPI File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/fastapi/applications.py", line 16, in from fastapi import routing File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/fastapi/routing.py", line 22, in from fastapi import params File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/fastapi/params.py", line 4, in from pydantic.fields import FieldInfo, Undefined ImportError: cannot import name 'Undefined' from 'pydantic.fields' (/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pydantic/fields.py)`

I am getting this. I am new to cog, I do not see the .pyenv folder in root

yorickvP commented 10 months ago

@happy-machine This step tries to import your predict.py, but doesn't run any setup or prediction functions. Are you doing anything time-consuming in predict.py?

@rdcoder33 @Sanawar21 currently, cog doesn't support pydantic>=2.0.0. You'll get this error if you use it in your requirements.txt

nateraw commented 8 months ago

Ah yea this error just came up for me today too. Here's a quick workaround...in cog.yaml just add a line in the run section that downgrades pydantic.

  run:
    # ...
    - pip install "pydantic<2.0.0"

Of course this could be done in the python_packages section but in my case pydantic gets installed in the run as some dependency of something I installed there. So this would fix the issue either way (and avoids rebuilding the whole image at the cost of a slightly bigger image size, since each run command is cached separately).