ContinualAI / avalanche

Avalanche: an End-to-End Library for Continual Learning based on PyTorch.
http://avalanche.continualai.org
MIT License
1.78k stars 290 forks source link

cannot import name 'DwsConvBlock' from 'pytorchcv.models.common' #1664

Open Anthony-Ho opened 2 months ago

Anthony-Ho commented 2 months ago

🐛 Describe the bug Using the colab notebook "02_models.ipynb", I encountered this error while executing the 2nd code block in the statement, "from avalanche.models import SimpleCNN".

🐜 To Reproduce Run the "02_models.ipynd" in Google Colab

🐝 Expected behavior No Errors and SampleCNN model is printed.

🐞 Screenshots

🦋 Additional context The error happens in "/usr/local/lib/python3.10/dist-packages/avalanche/models/mobilenetv1.py". The original statements were: try: from pytorchcv.models.mobilenet import DwsConvBlock except Exception: from pytorchcv.models.common import DwsConvBlock

"DwsConvBlock" is coded in common/conv.py, so the correct code should be: try: from pytorchcv.models.mobilenet import DwsConvBlock except Exception: from pytorchcv.models.common.conv import DwsConvBlock

gdacciaro commented 2 months ago

The problem is that pytorchcv is just updated to v0.0.69 on colab.

You can workaround this by downgrade the version to 0.0.67 with: !pip install pytorchcv==0.0.67

Most notebooks work after this workaround, apart from an exception: _AttributeError: ‘SimpleCNN’ object has no attribute ‘recursiveadaptation’ in the section Nested Dynamic Modules.

But I'm afraid this is another problem.