drivendataorg / zamba

A Python package for identifying 42 kinds of animals, training custom models, and estimating distance from camera trap videos
https://zamba.drivendata.org/docs/stable/
MIT License
118 stars 27 forks source link

Pin thop to avoid onnx dependency #191

Closed ejm714 closed 2 years ago

ejm714 commented 2 years ago

With the latest thop version released on June 10, 2022, thop requires onnx but doesn't install it. Our options are either to use an earlier version of thop or add the onnx dependency ourselves. Given that we don't need to use onnx, I've implemented the former.

The current error is as follows:

zamba --help
 ---> Running in f3d991f7f04a
Traceback (most recent call last):
  File "/usr/local/bin/zamba", line 5, in <module>
    from zamba.cli import app
  File "/usr/local/lib/python3.8/dist-packages/zamba/cli.py", line 10, in <module>
    from zamba.data.video import VideoLoaderConfig
  File "/usr/local/lib/python3.8/dist-packages/zamba/data/video.py", line 22, in <module>
    from zamba.object_detection.yolox.megadetector_lite_yolox import (
  File "/usr/local/lib/python3.8/dist-packages/zamba/object_detection/__init__.py", line 1, in <module>
    from zamba.object_detection.yolox.yolox_base import YoloXBase
  File "/usr/local/lib/python3.8/dist-packages/zamba/object_detection/yolox/yolox_base.py", line 4, in <module>
    from yolox.exp import Exp
  File "/usr/local/lib/python3.8/dist-packages/yolox/__init__.py", line 4, in <module>
    from .utils import configure_module
  File "/usr/local/lib/python3.8/dist-packages/yolox/utils/__init__.py", line 14, in <module>
    from .model_utils import *
  File "/usr/local/lib/python3.8/dist-packages/yolox/utils/model_utils.py", line 9, in <module>
    from thop import profile
  File "/usr/local/lib/python3.8/dist-packages/thop/__init__.py", line 3, in <module>
    from .onnx_profile import OnnxProfile
  File "/usr/local/lib/python3.8/dist-packages/thop/onnx_profile.py", line 3, in <module>
    import onnx
ModuleNotFoundError: No module named 'onnx'

This is further justification for setting up weekly test runs to catch this, per #188

Bonus fix: use less than or equals for protobuf as this consistently gets downgraded to 3.19.*.

github-actions[bot] commented 2 years ago

🚀 Deployed on https://deploy-preview-191--silly-keller-664934.netlify.app

codecov-commenter commented 2 years ago

Codecov Report

Merging #191 (47fceda) into master (7986c41) will decrease coverage by 0.2%. The diff coverage is n/a.

@@           Coverage Diff            @@
##           master    #191     +/-   ##
========================================
- Coverage    85.2%   85.0%   -0.3%     
========================================
  Files          30      30             
  Lines        1854    1832     -22     
========================================
- Hits         1581    1558     -23     
- Misses        273     274      +1     
Impacted Files Coverage Δ
zamba/version.py 80.0% <0.0%> (-20.0%) :arrow_down:
zamba/data/video.py 80.2% <0.0%> (-0.8%) :arrow_down:
zamba/models/densepose/config.py 92.2% <0.0%> (-0.2%) :arrow_down:
zamba/models/config.py 97.0% <0.0%> (-0.2%) :arrow_down:
zamba/models/model_manager.py 84.0% <0.0%> (-0.1%) :arrow_down:
zamba/models/utils.py 100.0% <0.0%> (ø)
ejm714 commented 2 years ago

@pjbull let me know if this looks good to you, and if so, i'll cut a new release

pjbull commented 2 years ago

Looks good to me. Can we see if thop is going to fix this, and if so add an issue to revisit this pin when they have a new release?

ejm714 commented 2 years ago

Added an issue to track that: https://github.com/drivendataorg/zamba/issues/192