mrhan1993 / Fooocus-API

FastAPI powered API for Fooocus
GNU General Public License v3.0
589 stars 159 forks source link

When uploading with Cog i get a pydantic error #401

Open micos7 opened 2 months ago

micos7 commented 2 months ago
Validating model schema...

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/cog/command/openapi_schema.py", line 46, in <module>
    raise CogError(app.state.setup_result.logs)
cog.errors.CogError: Error while loading predictor:

Traceback (most recent call last):
  File "/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/cog/server/http.py", line 130, in create_app
    predictor = load_slim_predictor_from_ref(predictor_ref, "predict")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/cog/predictor.py", line 242, in load_slim_predictor_from_ref
    module = load_full_predictor_from_file(module_path, module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/cog/predictor.py", line 202, in load_full_predictor_from_file
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/src/predict.py", line 29, in <module>
    from fooocusapi.parameters import ImageGenerationParams
  File "/src/fooocusapi/parameters.py", line 5, in <module>
    from fooocusapi.models.common.base import EnhanceCtrlNets
  File "/src/fooocusapi/models/common/base.py", line 6, in <module>
    from pydantic import (
**ImportError: cannot import name 'TypeAdapter' from 'pydantic' (/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/pydantic/__init__.cpython-311-x86_64-linux-gnu.so)**

Thanks for your work

EDIT:

Apparently this is an error with pydantic < 2 but in requirements it is already > 2. Confused.

EDIT2:

This is related to https://github.com/replicate/cog/issues/1562

mrhan1993 commented 2 days ago

Cog's version requirements for pydantic are too low, which is an incompatibility issue. But now the latest version of Cog seems to have upgraded its dependencies