因为1.8版本之后container_abcs就已经被移除了。
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
一个超级好用的调试APP,
前往应用市场
因为1.8版本之后container_abcs就已经被移除了。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 ==
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/mnt/lustre/chenshoufa/anaconda3/envs/
pytorch
18/lib/python3.8/site-packages/apex/__init__.py", line 8, in <module>
有人说是
torch
版本和
torch
vision没对应,大家可以先在这里对照一下自己的版本。
pytorch
/vision: Datasets, Transforms and Models specific to Computer Vision (github.com)https://github.com/
pytorch
/vision#installation
但是呢,我发现自己的版本是对应的,我的是
torch
1.9
.0,
torch
vision 0.10.0, python 3.9,都是最高版本。然.
cannot
import
name ‘
container
_
abcs
‘ from ‘
torch
._
six‘
错误
的
解决
方法
(一般
升级
pytorch
1.9
后
出现
)
因为1.8版本之后
container
_
abcs
就已经被移除了。
cannot
import
name ‘
container
_
abcs
’ from ‘
torch
._
six’
在使用一些开源代码的时候,可能会遇到该
错误
。
解决
方法
也很简单,我们只需要将原来的那行删去,换成下面的就行。
TORCH
_MAJOR = int(
torch
._
_version__.split('.')[0])
TORCH
_MINOR = int(
torch
._
_version__.split('.')[1])
if
TORCH
_MAJO