datvuthanh / HybridNets

HybridNets: End-to-End Perception Network
MIT License
582 stars 118 forks source link

No module named 'timm.models.layers.activations' #92

Closed praksharma closed 1 year ago

praksharma commented 1 year ago

I followed the exact steps to reproduce the results. The environment installation was okay.

(env) hell@homeserver:~/Desktop/HybridNets$ python hybridnets_test.py -w weights/hybridnets.pth --source demo/image --output demo_result --imshow False --imwrite True
Traceback (most recent call last):
  File "/home/hell/Desktop/HybridNets/hybridnets_test.py", line 4, in <module>
    from backbone import HybridNetsBackbone
  File "/home/hell/Desktop/HybridNets/backbone.py", line 9, in <module>
    from encoders import get_encoder
  File "/home/hell/Desktop/HybridNets/encoders/__init__.py", line 14, in <module>
    from .timm_efficientnet import timm_efficientnet_encoders
  File "/home/hell/Desktop/HybridNets/encoders/timm_efficientnet.py", line 8, in <module>
    from timm.models.layers.activations import Swish
ModuleNotFoundError: No module named 'timm.models.layers.activations'

Looks like timm has changed over the last 4 months. I've never used this package and has no idea how to fix it. Here is my pip freeze.

(env) hell@homeserver:~/Desktop/HybridNets$ pip freeze
albumentations==1.3.1
certifi==2023.5.7
charset-normalizer==3.1.0
cmake==3.26.4
contourpy==1.0.7
cycler==0.11.0
efficientnet-pytorch==0.7.1
filelock==3.12.1
fonttools==4.40.0
fsspec==2023.6.0
huggingface-hub==0.15.1
idna==3.4
imageio==2.31.1
Jinja2==3.1.2
joblib==1.2.0
kiwisolver==1.4.4
lazy_loader==0.2
lit==16.0.5.post0
MarkupSafe==2.1.3
matplotlib==3.7.1
mpmath==1.3.0
munch==3.0.0
networkx==3.1
numpy==1.24.3
nvidia-cublas-cu11==11.10.3.66
nvidia-cuda-cupti-cu11==11.7.101
nvidia-cuda-nvrtc-cu11==11.7.99
nvidia-cuda-runtime-cu11==11.7.99
nvidia-cudnn-cu11==8.5.0.96
nvidia-cufft-cu11==10.9.0.58
nvidia-curand-cu11==10.2.10.91
nvidia-cusolver-cu11==11.4.0.1
nvidia-cusparse-cu11==11.7.4.91
nvidia-nccl-cu11==2.14.3
nvidia-nvtx-cu11==11.7.91
opencv-python-headless==4.7.0.72
packaging==23.1
pandas==2.0.2
Pillow==9.5.0
prefetch-generator==1.0.3
pretrainedmodels==0.7.4
protobuf==3.20.3
pyparsing==3.0.9
python-dateutil==2.8.2
pytz==2023.3
PyWavelets==1.4.1
PyYAML==6.0
qudida==0.0.4
requests==2.31.0
safetensors==0.3.1
scikit-image==0.21.0
scikit-learn==1.2.2
scipy==1.10.1
seaborn==0.12.2
six==1.16.0
sympy==1.12
tensorboardX==2.6
threadpoolctl==3.1.0
tifffile==2023.4.12
timm==0.9.2
torch==2.0.1
torchvision==0.15.2
tqdm==4.65.0
triton==2.0.0
typing_extensions==4.6.3
tzdata==2023.3
urllib3==2.0.3
webcolors==1.13
(env) hell@homeserver:~/Desktop/HybridNets$ 
praksharma commented 1 year ago

Ok, I solved the issue. Just install the older version of timm. That why I don't trust these libraries as they randomly removed functions.

pip install timm==0.5.4