Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lifeischaotic opened this issue Jun 19, 2021 · 28 comments
Closed

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

lifeischaotic opened this issue Jun 19, 2021 · 28 comments

Comments

@lifeischaotic
Copy link

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
Copy link

viiika commented Jun 19, 2021

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

@lifeischaotic
Copy link
Author

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

@viiika
Copy link

viiika commented Jun 19, 2021 via email

@JulienMaille
Copy link
Contributor

This was fixed in timm repository back in February: huggingface/pytorch-image-models@94ca140#diff-c7abf83bc43184f6101237b08d7c489c361f3d57b3538d633f6f01d35254b73c Maybe you should try to update timm

@sumansahoo16
Copy link

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

@Nitz93
Copy link

Nitz93 commented Jun 20, 2021

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

@lifeischaotic
Copy link
Author

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

@i-aki-y
Copy link

i-aki-y commented Jun 21, 2021

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
Copy link

i-aki-y commented Jun 21, 2021

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
Copy link
Author

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
Copy link

i-aki-y commented Jun 21, 2021

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
Copy link
Author

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
Copy link
Author

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
Copy link

i-aki-y commented Jun 21, 2021

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

@richardgault
Copy link

richardgault commented Jun 21, 2021

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
Copy link

i-aki-y commented Jun 21, 2021

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
Copy link

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
Copy link
Author

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
Copy link

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
Copy link

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

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

@qubvel
Copy link
Owner

qubvel commented Jul 5, 2021

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
Copy link

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

@loretoparisi
Copy link

My solution was pip install timm==0.4.12

@firatkizilirmakk
Copy link

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
Copy link

erdemaysenur commented Mar 23, 2022

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
Copy link

Tomy992 commented Oct 22, 2022

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
Copy link

HarshitKmr10 commented Oct 24, 2022

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests