cannot import name ‘container_abcs‘ from ‘torch._six‘

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
else:
    import collections.abc as container_abcs

 

ImportError: cannot import name 'int_classes' from 'torch._six' (d:\Anaconda3\lib\site-packages\torch\_six.py)

在文件里面_six.py文件里面写入

import collections.abc as container_abcs
string_classes = (str, bytes)
int_classes = int

你可能感兴趣的:(算法优化,pytorch,深度学习,transformer)