qubvel-org / segmentation_models.pytorch

Semantic segmentation models with 500+ pretrained convolutional and transformer-based backbones.
https://smp.readthedocs.io/
MIT License
9.58k stars 1.67k forks source link

cannot import name 'container_abcs' from 'torch._six' #424

Closed lifeischaotic closed 2 years ago

lifeischaotic commented 3 years ago

Encountering this from today: 19-Jun-2021

ImportError Traceback (most recent call last)

in () 4 get_ipython().system('pip install -U segmentation-models-pytorch') 5 ----> 6 import segmentation_models_pytorch as smp 7 8 11 frames /usr/local/lib/python3.7/dist-packages/timm/models/layers/helpers.py in () 4 """ 5 from itertools import repeat ----> 6 from torch._six import container_abcs 7 8 ImportError: cannot import name 'container_abcs' from 'torch._six' (/usr/local/lib/python3.7/dist-packages/torch/_six.py)
viiika commented 3 years ago

I met the same problem. Last month it is correct.

lifeischaotic commented 3 years ago

Is it resolved for you? Or did you find a workaround?

viiika commented 3 years ago

I think it is caused by the latest update of the code.

You can use the code version one month ago, or temporarily replace it with the pre-trained model in torchvision module.

On Sat, Jun 19, 2021 at 8:03 PM hariharasudhane @.***> wrote:

Is it resolved for you? Or did you find a workaround?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/qubvel/segmentation_models.pytorch/issues/424#issuecomment-864397327, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJP2CWYA6VBFS4QUNKZ4RRTTTSBSNANCNFSM4662DMXA .

JulienMaille commented 3 years ago

This was fixed in timm repository back in February: https://github.com/rwightman/pytorch-image-models/commit/94ca140b67cb602ee7e146af32bfb63b60df96f4#diff-c7abf83bc43184f6101237b08d7c489c361f3d57b3538d633f6f01d35254b73c Maybe you should try to update timm

sumansahoo16 commented 3 years ago

@hariharasudhane I am facing the same problem. How to resolve it?

Nitz93 commented 3 years ago

@hariharasudhane i am also facing the same issue, is it resolved or did you find any workaround?

lifeischaotic commented 3 years ago

Updating timm resolved this issue for me @Nitz93 @sumansahoo16 @JB-Bai Thanks @JulienMaille

i-aki-y commented 3 years ago

It seems to depend on the encoder type. In my case, if timm-*** encoder is used, it fails with the following error after the timm update:

TypeError: __init__() got an unexpected keyword argument 'channel_multiplier'

But other encoders like 'efficientnet-b0' seem to work with updating timm.

i-aki-y commented 3 years ago

I have run pytest in this repo just after timm update. Errors seem to happen in the following encoder:

timm-(tf)-efficientnet- timm-skresnet

This is the short summary of the pytest tests.

====================================================== short test summary info ======================================================
FAILED tests/test_models.py::test_forward[FPN-3-timm-efficientnet-b0] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-3-timm-efficientnet-b1] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-3-timm-efficientnet-b2] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-3-timm-efficientnet-b3] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-3-timm-efficientnet-b4] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-3-timm-efficientnet-b5] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-3-timm-efficientnet-b6] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-3-timm-efficientnet-b7] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-3-timm-efficientnet-b8] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-3-timm-efficientnet-l2] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-3-timm-tf_efficientnet_lite0] - TypeError: __init__() got an unexpected keyword argu...
FAILED tests/test_models.py::test_forward[FPN-3-timm-tf_efficientnet_lite1] - TypeError: __init__() got an unexpected keyword argu...
FAILED tests/test_models.py::test_forward[FPN-3-timm-tf_efficientnet_lite2] - TypeError: __init__() got an unexpected keyword argu...
FAILED tests/test_models.py::test_forward[FPN-3-timm-tf_efficientnet_lite3] - TypeError: __init__() got an unexpected keyword argu...
FAILED tests/test_models.py::test_forward[FPN-3-timm-tf_efficientnet_lite4] - TypeError: __init__() got an unexpected keyword argu...
FAILED tests/test_models.py::test_forward[FPN-3-timm-skresnet18] - TypeError: __init__() got an unexpected keyword argument 'min_a...
FAILED tests/test_models.py::test_forward[FPN-3-timm-skresnet34] - TypeError: __init__() got an unexpected keyword argument 'min_a...
FAILED tests/test_models.py::test_forward[FPN-5-timm-efficientnet-b0] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-5-timm-efficientnet-b1] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-5-timm-efficientnet-b2] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-5-timm-efficientnet-b3] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-5-timm-efficientnet-b4] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-5-timm-efficientnet-b5] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-5-timm-efficientnet-b6] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-5-timm-efficientnet-b7] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-5-timm-efficientnet-b8] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-5-timm-efficientnet-l2] - TypeError: __init__() got an unexpected keyword argument '...
FAILED tests/test_models.py::test_forward[FPN-5-timm-tf_efficientnet_lite0] - TypeError: __init__() got an unexpected keyword argu...
FAILED tests/test_models.py::test_forward[FPN-5-timm-tf_efficientnet_lite1] - TypeError: __init__() got an unexpected keyword argu...
FAILED tests/test_models.py::test_forward[FPN-5-timm-tf_efficientnet_lite2] - TypeError: __init__() got an unexpected keyword argu...
FAILED tests/test_models.py::test_forward[FPN-5-timm-tf_efficientnet_lite3] - TypeError: __init__() got an unexpected keyword argu...
FAILED tests/test_models.py::test_forward[FPN-5-timm-tf_efficientnet_lite4] - TypeError: __init__() got an unexpected keyword argu...
FAILED tests/test_models.py::test_forward[FPN-5-timm-skresnet18] - TypeError: __init__() got an unexpected keyword argument 'min_a...
FAILED tests/test_models.py::test_forward[FPN-5-timm-skresnet34] - TypeError: __init__() got an unexpected keyword argument 'min_a...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-efficientnet-b0] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-efficientnet-b1] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-efficientnet-b2] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-efficientnet-b3] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-efficientnet-b4] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-efficientnet-b5] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-efficientnet-b6] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-efficientnet-b7] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-efficientnet-b8] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-efficientnet-l2] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-tf_efficientnet_lite0] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-tf_efficientnet_lite1] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-tf_efficientnet_lite2] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-tf_efficientnet_lite3] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-tf_efficientnet_lite4] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-skresnet18] - TypeError: __init__() got an unexpected keyword argument 'mi...
FAILED tests/test_models.py::test_forward[PSPNet-3-timm-skresnet34] - TypeError: __init__() got an unexpected keyword argument 'mi...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-efficientnet-b0] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-efficientnet-b1] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-efficientnet-b2] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-efficientnet-b3] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-efficientnet-b4] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-efficientnet-b5] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-efficientnet-b6] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-efficientnet-b7] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-efficientnet-b8] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-efficientnet-l2] - TypeError: __init__() got an unexpected keyword argumen...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-tf_efficientnet_lite0] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-tf_efficientnet_lite1] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-tf_efficientnet_lite2] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-tf_efficientnet_lite3] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-tf_efficientnet_lite4] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-skresnet18] - TypeError: __init__() got an unexpected keyword argument 'mi...
FAILED tests/test_models.py::test_forward[PSPNet-5-timm-skresnet34] - TypeError: __init__() got an unexpected keyword argument 'mi...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-efficientnet-b0] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-efficientnet-b1] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-efficientnet-b2] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-efficientnet-b3] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-efficientnet-b4] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-efficientnet-b5] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-efficientnet-b6] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-efficientnet-b7] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-efficientnet-b8] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-efficientnet-l2] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-tf_efficientnet_lite0] - TypeError: __init__() got an unexpected keyword ...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-tf_efficientnet_lite1] - TypeError: __init__() got an unexpected keyword ...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-tf_efficientnet_lite2] - TypeError: __init__() got an unexpected keyword ...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-tf_efficientnet_lite3] - TypeError: __init__() got an unexpected keyword ...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-tf_efficientnet_lite4] - TypeError: __init__() got an unexpected keyword ...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-skresnet18] - TypeError: __init__() got an unexpected keyword argument 'm...
FAILED tests/test_models.py::test_forward[Linknet-3-timm-skresnet34] - TypeError: __init__() got an unexpected keyword argument 'm...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-efficientnet-b0] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-efficientnet-b1] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-efficientnet-b2] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-efficientnet-b3] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-efficientnet-b4] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-efficientnet-b5] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-efficientnet-b6] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-efficientnet-b7] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-efficientnet-b8] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-efficientnet-l2] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-tf_efficientnet_lite0] - TypeError: __init__() got an unexpected keyword ...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-tf_efficientnet_lite1] - TypeError: __init__() got an unexpected keyword ...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-tf_efficientnet_lite2] - TypeError: __init__() got an unexpected keyword ...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-tf_efficientnet_lite3] - TypeError: __init__() got an unexpected keyword ...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-tf_efficientnet_lite4] - TypeError: __init__() got an unexpected keyword ...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-skresnet18] - TypeError: __init__() got an unexpected keyword argument 'm...
FAILED tests/test_models.py::test_forward[Linknet-5-timm-skresnet34] - TypeError: __init__() got an unexpected keyword argument 'm...
FAILED tests/test_models.py::test_forward[Unet-3-timm-efficientnet-b0] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-3-timm-efficientnet-b1] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-3-timm-efficientnet-b2] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-3-timm-efficientnet-b3] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-3-timm-efficientnet-b4] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-3-timm-efficientnet-b5] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-3-timm-efficientnet-b6] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-3-timm-efficientnet-b7] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-3-timm-efficientnet-b8] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-3-timm-efficientnet-l2] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-3-timm-tf_efficientnet_lite0] - TypeError: __init__() got an unexpected keyword arg...
FAILED tests/test_models.py::test_forward[Unet-3-timm-tf_efficientnet_lite1] - TypeError: __init__() got an unexpected keyword arg...
FAILED tests/test_models.py::test_forward[Unet-3-timm-tf_efficientnet_lite2] - TypeError: __init__() got an unexpected keyword arg...
FAILED tests/test_models.py::test_forward[Unet-3-timm-tf_efficientnet_lite3] - TypeError: __init__() got an unexpected keyword arg...
FAILED tests/test_models.py::test_forward[Unet-3-timm-tf_efficientnet_lite4] - TypeError: __init__() got an unexpected keyword arg...
FAILED tests/test_models.py::test_forward[Unet-3-timm-skresnet18] - TypeError: __init__() got an unexpected keyword argument 'min_...
FAILED tests/test_models.py::test_forward[Unet-3-timm-skresnet34] - TypeError: __init__() got an unexpected keyword argument 'min_...
FAILED tests/test_models.py::test_forward[Unet-5-timm-efficientnet-b0] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-5-timm-efficientnet-b1] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-5-timm-efficientnet-b2] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-5-timm-efficientnet-b3] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-5-timm-efficientnet-b4] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-5-timm-efficientnet-b5] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-5-timm-efficientnet-b6] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-5-timm-efficientnet-b7] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-5-timm-efficientnet-b8] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-5-timm-efficientnet-l2] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_forward[Unet-5-timm-tf_efficientnet_lite0] - TypeError: __init__() got an unexpected keyword arg...
FAILED tests/test_models.py::test_forward[Unet-5-timm-tf_efficientnet_lite1] - TypeError: __init__() got an unexpected keyword arg...
FAILED tests/test_models.py::test_forward[Unet-5-timm-tf_efficientnet_lite2] - TypeError: __init__() got an unexpected keyword arg...
FAILED tests/test_models.py::test_forward[Unet-5-timm-tf_efficientnet_lite3] - TypeError: __init__() got an unexpected keyword arg...
FAILED tests/test_models.py::test_forward[Unet-5-timm-tf_efficientnet_lite4] - TypeError: __init__() got an unexpected keyword arg...
FAILED tests/test_models.py::test_forward[Unet-5-timm-skresnet18] - TypeError: __init__() got an unexpected keyword argument 'min_...
FAILED tests/test_models.py::test_forward[Unet-5-timm-skresnet34] - TypeError: __init__() got an unexpected keyword argument 'min_...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-efficientnet-b0] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-efficientnet-b1] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-efficientnet-b2] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-efficientnet-b3] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-efficientnet-b4] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-efficientnet-b5] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-efficientnet-b6] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-efficientnet-b7] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-efficientnet-b8] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-efficientnet-l2] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-tf_efficientnet_lite0] - TypeError: __init__() got an unexpected key...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-tf_efficientnet_lite1] - TypeError: __init__() got an unexpected key...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-tf_efficientnet_lite2] - TypeError: __init__() got an unexpected key...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-tf_efficientnet_lite3] - TypeError: __init__() got an unexpected key...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-tf_efficientnet_lite4] - TypeError: __init__() got an unexpected key...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-skresnet18] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-3-timm-skresnet34] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-efficientnet-b0] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-efficientnet-b1] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-efficientnet-b2] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-efficientnet-b3] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-efficientnet-b4] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-efficientnet-b5] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-efficientnet-b6] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-efficientnet-b7] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-efficientnet-b8] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-efficientnet-l2] - TypeError: __init__() got an unexpected keyword a...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-tf_efficientnet_lite0] - TypeError: __init__() got an unexpected key...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-tf_efficientnet_lite1] - TypeError: __init__() got an unexpected key...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-tf_efficientnet_lite2] - TypeError: __init__() got an unexpected key...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-tf_efficientnet_lite3] - TypeError: __init__() got an unexpected key...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-tf_efficientnet_lite4] - TypeError: __init__() got an unexpected key...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-skresnet18] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_forward[UnetPlusPlus-5-timm-skresnet34] - TypeError: __init__() got an unexpected keyword argume...
FAILED tests/test_models.py::test_dilation[timm-efficientnet-b0] - TypeError: __init__() got an unexpected keyword argument 'chann...
FAILED tests/test_models.py::test_dilation[timm-efficientnet-b1] - TypeError: __init__() got an unexpected keyword argument 'chann...
FAILED tests/test_models.py::test_dilation[timm-efficientnet-b2] - TypeError: __init__() got an unexpected keyword argument 'chann...
FAILED tests/test_models.py::test_dilation[timm-efficientnet-b3] - TypeError: __init__() got an unexpected keyword argument 'chann...
FAILED tests/test_models.py::test_dilation[timm-efficientnet-b4] - TypeError: __init__() got an unexpected keyword argument 'chann...
FAILED tests/test_models.py::test_dilation[timm-efficientnet-b5] - TypeError: __init__() got an unexpected keyword argument 'chann...
FAILED tests/test_models.py::test_dilation[timm-efficientnet-b6] - TypeError: __init__() got an unexpected keyword argument 'chann...
FAILED tests/test_models.py::test_dilation[timm-efficientnet-b7] - TypeError: __init__() got an unexpected keyword argument 'chann...
FAILED tests/test_models.py::test_dilation[timm-efficientnet-b8] - TypeError: __init__() got an unexpected keyword argument 'chann...
FAILED tests/test_models.py::test_dilation[timm-efficientnet-l2] - TypeError: __init__() got an unexpected keyword argument 'chann...
FAILED tests/test_models.py::test_dilation[timm-tf_efficientnet_lite0] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_dilation[timm-tf_efficientnet_lite1] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_dilation[timm-tf_efficientnet_lite2] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_dilation[timm-tf_efficientnet_lite3] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_dilation[timm-tf_efficientnet_lite4] - TypeError: __init__() got an unexpected keyword argument ...
FAILED tests/test_models.py::test_dilation[timm-skresnet18] - TypeError: __init__() got an unexpected keyword argument 'min_attn_c...
FAILED tests/test_models.py::test_dilation[timm-skresnet34] - TypeError: __init__() got an unexpected keyword argument 'min_attn_c...
====================================== 187 failed, 1311 passed, 1 warning in 584.69s (0:09:44) ======================================
lifeischaotic commented 3 years ago

Sorry to say that my issue popped up again.

MY STORY:

SCENARIO 1: 4 days back everything was running smooth with UNet with EfficientNet-B0 encoder model.

Then I started encountering the following error on any Architecture+Encoder combination cannot import name 'container_abcs' from 'torch._six'

SCENARIO 2: So based on this thread, I updated timm to latest: !pip install timm==0.4.9 But executing the training with latest timm also gives an error. This time the error is different. Length of values (840) does not match length of index (837)

And one more error pops up that is: ERROR: segmentation-models-pytorch 0.1.3 has requirement timm==0.3.2, but you'll have timm 0.4.9 which is incompatible.

The above error doesn't affect the execution though. Hence I was happy, but the length of values error is making my training useless.

SCENARIO 3: Finally, maybe installing 0.3.2 timm might resolve the issues, but installing 0.3.2 brings back the original error: cannot import name 'container_abcs' from 'torch._six'

i-aki-y commented 3 years ago

Length of values (840) does not match length of index (837)

@hariharasudhane Where is this error message coming from?

I think this message seems to be the pandas's error message. https://github.com/pandas-dev/pandas/blob/98e22297bb66f81ff4c1d4f1c3277cfe8c6b9ce7/pandas/core/common.py#L522

lifeischaotic commented 3 years ago

Length of values (840) does not match length of index (837)

@hariharasudhane Where is this error message coming from?

I think this message seems to be the pandas's error message. https://github.com/pandas-dev/pandas/blob/98e22297bb66f81ff4c1d4f1c3277cfe8c6b9ce7/pandas/core/common.py#L522

Oh yes. That error is unrelated to this thread. But mentioned that error anyway. I should play around with the dimensions maybe to resolve that value error.

lifeischaotic commented 3 years ago

Can the Pytorch version give out the error?

I just realized that the only change that has happened in my notebook between the errors popping up is the upgrade of pytorch to 1.9 from 1.8 in Google colab. I am running my notebook in colab btw.

i-aki-y commented 3 years ago

This is also discussed here: https://github.com/NVIDIA/apex/pull/1049

So, downgrading to the pytorch 1.8.1 will also fix the 'torch._six’ error.

In colab, the commands will be like this:

!pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
!pip install torchtext==0.9.1
richardgault commented 3 years ago

Neither updating trimm (to 0.4.9) nor downgrading PyTorch to 1.8.1 worked for me.

---> import segmentation_models_pytorch as smp

/usr/local/lib/python3.7/dist-packages/timm/models/layers/helpers.py in <module>()
      4 """
      5 from itertools import repeat
----> 6 from torch._six import container_abcs
      7 
      8 

ImportError: cannot import name 'container_abcs' from 'torch._six' (/usr/local/lib/python3.7/dist-packages/torch/_six.py
i-aki-y commented 3 years ago

Hmm, It seems to be strange for me because timm v0.4.9 does not have torch._siz dependency. See, https://github.com/rwightman/pytorch-image-models/blob/v0.4.9/timm/models/layers/helpers.py

What is given if you run this?

import torch
import timm
print(torch.__version__)
print(timm.__version__)
richardgault commented 3 years ago

Thanks for the post i-aki-y! Torch version is: 1.9.0+cu102 Issues importing timm: --->20 import timm 21 print(timm.version)

/usr/local/lib/python3.7/dist-packages/timm/models/layers/helpers.py in () 4 """ 5 from itertools import repeat ----> 6 from torch._six import container_abcs 7 8

ImportError: cannot import name 'container_abcs' from 'torch._six' (/usr/local/lib/python3.7/dist-packages/torch/_six.py)

lifeischaotic commented 3 years ago

This is also discussed here: NVIDIA/apex#1049

So, downgrading to the pytorch 1.8.1 will also fix the 'torch._six’ error.

In colab, the commands will be like this:

!pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
!pip install torchtext==0.9.1

Finally this worked for me.

richardgault commented 3 years ago

Apologies the suggested solution (below) works - it appears I had installed packages later that updated PyTorch and reversed the forced downgrade!! Thanks for the help @i-aki-y , @hariharasudhane

This is also discussed here: NVIDIA/apex#1049

So, downgrading to the pytorch 1.8.1 will also fix the 'torch._six’ error.

In colab, the commands will be like this:

!pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
!pip install torchtext==0.9.1
vasudev-sharma commented 3 years ago

Updating timm resolved this issue for me @Nitz93 @sumansahoo16 @JB-Bai Thanks @JulienMaille

I met the same issue. Upgrading timm worked for me.

qubvel commented 3 years ago

Package updated (0.2.0) with new timm==0.4.12 and tested with torch==1.9.0 Let me know if you still facing this problem after updating

gmuraleekrishna commented 2 years ago

You may change from torch._six import container_abcs to from collections import abc as container_abcs

loretoparisi commented 2 years ago

My solution was pip install timm==0.4.12

firatkizilirmakk commented 2 years ago

Package updated (0.2.0) with new timm==0.4.12 and tested with torch==1.9.0 Let me know if you still facing this problem after updating

This worked for me as well.

erdemaysenur commented 2 years ago

I was facing this issue while trying to import read_image from torchvision.io and pip install torch==1.8.1 worked for me.

Tomy992 commented 2 years ago

I am also using colab and faced the same problem and arrived at this github. I installed an older version of torch, but when I import it, it reverts back to the original, latest version.

`!pip uninstall torch torchvision torchaudio torchtext timm !pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html !pip install torchtext==0.9.1 !pip install timm==0.4.12

import torch print(torch.version)

1.12.1+cu113

from torch._six import container_abcs

ImportError: cannot import name 'container_abcs' from 'torch._six'`

HarshitKmr10 commented 2 years ago

I am working in Kaggle Notebooks and I tried

!pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
!pip install torchtext==0.9.1

But still no luck. It still shows ImportError: cannot import name 'container_abcs' from 'torch._six'

zhangyuanyang21 commented 1 year ago

Package updated (0.2.0) with new timm==0.4.12 and tested with torch==1.9.0 Let me know if you still facing this problem after updating right

Yanchun-Li commented 5 months ago

I changed from torch._six import container_abcs to from collections.abc import Iterable, ... and the problem was solved. There wasn't version conflict of timm.