首页 > 解决方案 > 无法使用 colaboratory 在 mmdetection 中编译 nms_cuda

问题描述

/usr/local/lib/python3.6/dist-packages/torch/include/ATen/core/TensorBody.h:262:30: note: declared here
   DeprecatedTypeProperties & type() const {
                              ^~~~
mmdet/ops/nms/src/nms_cuda.cpp:4:23: error: ‘AT_CHECK’ was not declared in this scope
 #define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
                       ^
mmdet/ops/nms/src/nms_cuda.cpp:4:23: note: in definition of macro ‘CHECK_CUDA’
 #define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
                       ^~~~~~~~
mmdet/ops/nms/src/nms_cuda.cpp:4:23: note: suggested alternative: ‘DCHECK’
 #define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
                       ^
mmdet/ops/nms/src/nms_cuda.cpp:4:23: note: in definition of macro ‘CHECK_CUDA’
 #define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
                       ^~~~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

现在我得到的所有信息:

正常吗?发生了什么?库达错误?gcc 错误?怎么解决。我急着用它来运行 mmdetection 程序。

标签: google-colaboratoryobject-detection

解决方案


解决方案是:

conda install pytorch cudatoolkit==10.0 torchvision -c pytorch -y

如果使用早于 v2.0.0 的分支。

或者:

conda install pytorch cudatoolkit torchvision -c pytorch -y

如果分支等于 v2.0.0。

我花了 3 天时间才弄清楚这一点。基本上,如果您安装 cudatoolkit==10.0,这将强制 pytorch 降级到 pytorch 1.4 版,从而使整个工作正常。它一点也不明显。在我看来,这是 mmdetection 安装指南中的一个错误。


推荐阅读