Reputation: 115
I'm trying to run the deit colab notebook found here:
but I'm running into an issue in the second cell, specifically the import timm
line, which returns this:
ImportError: cannot import name 'container_abcs' from 'torch._six'
Upvotes: 5
Views: 22025
Reputation: 39
I encountered this problem when I was working on PyTorch 1.12 version with a code base developed on PyTorch 1.6.
You should replace
from torch._six import container_abcs
with
import collections.abc as container_abcs
as per this issue on GitHub.
Upvotes: 0
Reputation: 1602
Try a specific version of timm
library:
!pip install timm==0.3.2
Upvotes: 3
Reputation: 21
when I install torch==1.9.0 and torch-geometric, the old code has the errors.
here is my solution:
TORCH_MAJOR = int(torch.__version__.split('.')[0])
TORCH_MINOR = int(torch.__version__.split('.')[1])
if TORCH_MAJOR == 0:
import collections.abc as container_abcs
else:
from torch._six import container_abcs
change to:
TORCH_MAJOR = int(torch.__version__.split('.')[0])
TORCH_MINOR = int(torch.__version__.split('.')[1])
if TORCH_MAJOR == 1 and TORCH_MINOR < 8:
from torch._six import container_abcs,int_classes
else:
import collections.abc as container_abcs
int_classes = int
Upvotes: 2