Open ffcai opened 2 years ago
https://github.com/eto-ai/rikai/pull/671#issuecomment-1169960885
Error message:
Py4JJavaError: An error occurred while calling o36.sql.
: java.lang.RuntimeException: 2022-06-29 20:53:09,545 INFO Rikai (base.py:60): Resolving model yolov5m from torchhub:///ultralytics/yolov5:v6.0/yolov5mTraceback (most recent call last): File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/internal/reflection.py", line 34, in has_func mod = importlib.import_module(module)
File "/Users/da/.pyenv/versions/3.8.10/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/contrib/torchhub/ultralytics/yolov5/__init__.py", line 1, in <module> from rikai.contrib.torchhub.ultralytics.yolov5 import yolov5
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/contrib/torchhub/ultralytics/yolov5/yolov5.py", line 43, in <module> from rikai.pytorch.models import TorchModelType
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/pytorch/models/__init__.py", line 17, in <module> import rikai.pytorch.models.convnext
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/pytorch/models/convnext.py", line 22, in <module> "convnext", pretrained_fn=torchvision.models.convnext_baseAttributeError: module 'torchvision.models' has no attribute 'convnext_base'During handling of the above exception, another exception occurred:Traceback (most recent call last): File "<string>", line 6, in <module>
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/spark/sql/codegen/base.py", line 125, in command_from_spec return registry.resolve(row_spec)
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/spark/sql/codegen/base.py", line 61, in resolve return udf_from_spec(self.make_model_spec(raw_spec))
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/experimental/torchhub/torchhub_registry.py", line 83, in make_model_spec return TorchHubModelSpec(repo_or_dir, model, raw_spec)
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/experimental/torchhub/torchhub_registry.py", line 48, in __init__ if has_func(model_type + ".MODEL_TYPE"): File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/internal/reflection.py", line 39, in has_func mod = importlib.import_module(module) File "/Users/da/.pyenv/versions/3.8.10/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/contrib/torchhub/ultralytics/yolov5/__init__.py", line 1, in <module> from rikai.contrib.torchhub.ultralytics.yolov5 import yolov5
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/contrib/torchhub/ultralytics/yolov5/yolov5.py", line 43, in <module> from rikai.pytorch.models import TorchModelType
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/pytorch/models/__init__.py", line 17, in <module> import rikai.pytorch.models.convnext
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/pytorch/models/convnext.py", line 22, in <module> "convnext", pretrained_fn=torchvision.models.convnext_base
AttributeError: module 'torchvision.models' has no attribute 'convnext_base'
While the following code snippet works fine
Python 3.8.10 (default, May 19 2021, 11:01:55)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rikai
>>> rikai.__version__.version
'0.1.12'
>>> import rikai.pytorch.models.convnext
>>>
>>> import rikai.contrib.torchhub.ultralytics.yolov5.MODEL_TYPE
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/contrib/torchhub/ultralytics/yolov5/__init__.py", line 1, in <module>
from rikai.contrib.torchhub.ultralytics.yolov5 import yolov5
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/contrib/torchhub/ultralytics/yolov5/yolov5.py", line 43, in <module>
from rikai.pytorch.models import TorchModelType
ImportError: cannot import name 'TorchModelType' from 'rikai.pytorch.models' (/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/pytorch/models/__init__.py)
>>> from rikai.pytorch.models import TorchModelType
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'TorchModelType' from 'rikai.pytorch.models' (/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/pytorch/models/__init__.py)
Could be fixed by correctly importing TorchModelType.
There seems to be a breaking change in #606 .
>>> import rikai.contrib.torchhub.ultralytics.yolov5.MODEL_TYPE
/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/torch/torch_version.py:3: UserWarning: Module rikai was already imported from /Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/__init__.py, but /Users/da/github/Tubitv/rikai-yolov5 is being added to sys.path
from pkg_resources import packaging # type: ignore[attr-defined]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/contrib/torchhub/ultralytics/yolov5/__init__.py", line 1, in <module>
from rikai.contrib.torchhub.ultralytics.yolov5 import yolov5
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/contrib/torchhub/ultralytics/yolov5/yolov5.py", line 43, in <module>
from rikai.pytorch.models.torch import TorchModelType
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/pytorch/models/__init__.py", line 17, in <module>
import rikai.pytorch.models.convnext
File "/Users/da/.pyenv/versions/rikai-yolov5/lib/python3.8/site-packages/rikai/pytorch/models/convnext.py", line 22, in <module>
"convnext", pretrained_fn=torchvision.models.convnext_base
AttributeError: module 'torchvision.models' has no attribute 'convnext_base'
Just tried https://github.com/eto-ai/rikai/blob/main/notebooks/Mojito.ipynb Failed to load Yolo v5 model. I'm not sure if it's my environment. This example notebook was working weeks ago.