25 errors detected in the compilation of "E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu".
error: command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin\nvcc.exe' failed with exit code 1
2.后来我在网上查了资料,尝试用mmcv模块自带的from mmcv.ops.multi_scale_deform_attn import ext_module as MSDA代替ops\functions\ms_deform_attn_func.py 中的import MultiScaleDeformableAttention as MSDA,在运行训练脚本时,出现错误:
Traceback (most recent call last):
File "E:/mmsegmentation-0.20.2/train.py", line 217, in
main()
File "E:/mmsegmentation-0.20.2/train.py", line 206, in main
train_segmentor(
File "E:\mmsegmentation-0.20.2\mmseg\apis\train.py", line 167, in train_segmentor
runner.run(data_loaders, cfg.workflow)
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\mmcv\runner\iter_based_runner.py", line 134, in run
iter_runner(iter_loaders[i], *kwargs)
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\mmcv\runner\iter_based_runner.py", line 67, in train
self.call_hook('after_train_iter')
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\mmcv\runner\base_runner.py", line 309, in call_hook
getattr(hook, fn_name)(self)
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\mmcv\runner\hooks\optimizer.py", line 56, in after_train_iter
runner.outputs['loss'].backward()
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\torch_tensor.py", line 255, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\torch\autograd__init__.py", line 147, in backward
Variable._execution_engine.run_backward(
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\torch\autograd\function.py", line 87, in apply
return self._forward_cls.backward(self, args) # type: ignore[attr-defined]
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\torch\autograd\function.py", line 204, in wrapper
outputs = fn(ctx, args)
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\torch\cuda\amp\autocast_mode.py", line 236, in decorate_bwd
return bwd(args, **kwargs)
File "E:\mmseg\ops\functions\ms_deform_attn_func.py", line 42, in backward
MSDA.ms_deform_attn_backward(
TypeError: ms_deform_attn_backward(): incompatible function arguments. The following argument types are supported:
running build_ext E:\mmseg\ops\torch\utils\cpp_extension.py:370: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend. warnings.warn(msg.format('we could not find ninja.')) E:\mmseg\ops\torch\utils\cpp_extension.py:305: UserWarning: Error checking compiler version for cl: 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byte”: 已将析构函数隐式定义为“已删除”
with
[
T=at::Tensor
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=at::Tensor
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=at::Tensor
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase”的引用
E:\mmseg\ops\torch\include\ATen/core/TensorBody.h(734): note: 查看对正在编译的 类 模板 实例化“c10::optional”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=at::Tensor
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=at::Generator
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=at::Generator
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=at::Generator
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase”的引用
E:\mmseg\ops\torch\include\ATen/core/TensorBody.h(800): note: 查看对正在编译的 类 模板 实例化“c10::optional”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=at::Generator
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=c10::impl::InlineDeviceGuard
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=c10::impl::InlineDeviceGuard
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=c10::impl::InlineDeviceGuard
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase<c10::impl::InlineDeviceGuard>”的引用>”的引 用
E:\mmseg\ops\torch\include\c10/core/DeviceGuard.h(178): note: 查看对正在编译的 类 模板 实例化“c10::impl::InlineOptionalDeviceGuard”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=c10::impl::InlineDeviceGuard
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=std::string
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=std::string
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=std::string
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase”的引用
E:\mmseg\ops\torch\include\ATen/core/jit_type_base.h(107): note: 查看对正在编译的 类 模板 实例化“c10::optional”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=std::string
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<c10::ShapeSymbol,std::allocator>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=std::vector<c10::ShapeSymbol,std::allocator>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=std::vector<c10::ShapeSymbol,std::allocator>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase<std::vector<c10::ShapeSymbol,std::allocator>>”的引用>>”的引用”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<c10::ShapeSymbol,std::allocator>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<c10::optional,std::allocator<c10::optional>>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=std::vector<c10::optional,std::allocator<c10::optional>>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=std::vector<c10::optional,std::allocator<c10::optional>>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase<std::vector<c10::optional,std::allocator<c10::optional>>>”的引用
E:\mmseg\ops\torch\include\ATen/core/jit_type.h(425): note: 查看对正在编译的 类 模板 实例化“c10::optional<std::vector<c10::optional,std::allocator<c10::optional>>>”的引用
E:\mmseg\ops\torch\include\ATen/core/jit_type.h(664): note: 查看对正在编译的 类 模板 实例化“c10::VaryingShape”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<c10::optional,std::allocator<c10::optional>>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<c10::optional,std::allocator<c10::optional>>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=std::vector<c10::optional,std::allocator<c10::optional>>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=std::vector<c10::optional,std::allocator<c10::optional>>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase<std::vector<c10::optional,std::allocator<c10::optional>>>”的引用
E:\mmseg\ops\torch\include\ATen/core/jit_type.h(425): note: 查看对正在编译的 类 模板 实例化“c10::optional<std::vector<c10::optional,std::allocator<c10::optional>>>” 的引用
E:\mmseg\ops\torch\include\ATen/core/jit_type.h(470): note: 查看对正在编译的 类 模板 实例化“c10::VaryingShape”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<c10::optional,std::allocator<c10::optional>>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<int64_t,std::allocator>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=std::vector<int64_t,std::allocator>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=std::vector<int64_t,std::allocator>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase<std::vector<int64_t,std::allocator>>”的引用
E:\mmseg\ops\torch\include\ATen/core/jit_type.h(568): note: 查看对正在编译的 类 模板 实例化“c10::optional<std::vector<int64_t,std::allocator>>”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<int64_t,std::allocator>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=c10::QualifiedName
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=c10::QualifiedName
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=c10::QualifiedName
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase”的引用
E:\mmseg\ops\torch\include\ATen/core/jit_type.h(903): note: 查看对正在编译的 类 模板 实例化“c10::optional”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=c10::QualifiedName
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=c10::impl::InlineStreamGuard
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=c10::impl::InlineStreamGuard
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=c10::impl::InlineStreamGuard
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase<c10::impl::InlineStreamGuard>”的引用>”的引 用
E:\mmseg\ops\torch\include\c10/core/StreamGuard.h(139): note: 查看对正在编译的 类 模板 实例化“c10::impl::InlineOptionalStreamGuard”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=c10::impl::InlineStreamGuard
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=c10::impl::VirtualGuardImpl
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=c10::impl::VirtualGuardImpl
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=c10::impl::VirtualGuardImpl
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase”的引用
E:\mmseg\ops\torch\include\c10/core/impl/InlineStreamGuard.h(231): note: 查看对正在编译的 类 模板 实例化“c10::optional”的引用
with
[
T=c10::impl::VirtualGuardImpl
]
E:\mmseg\ops\torch\include\c10/core/StreamGuard.h(162): note: 查看对正在编译的 类 模板 实例化“c10::impl::InlineMultiStreamGuard”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=c10::impl::VirtualGuardImpl
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<std::reference_wrapper,std::allocator<std::reference_wrapper>>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=std::vector<std::reference_wrapper,std::allocator<std::reference_wrapper>>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=std::vector<std::reference_wrapper,std::allocator<std::reference_wrapper>>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase<std::vector<std::reference_wrapper,std::allocator<std::reference_wrapper>>>”的引用
E:\mmseg\ops\torch\include\ATen/core/ivalue_inl.h(362): note: 查看对正在编译的 类 模板 实例化“c10::optional<std::vector<std::reference_wrapper,std::allocator<std::reference_wrapper>>>”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<std::reference_wrapper,std::allocator<std::reference_wrapper>>
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=c10::OperatorName
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=c10::OperatorName
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=c10::OperatorName
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase”的引用
E:\mmseg\ops\torch\include\ATen/record_function.h(306): note: 查看对正在编译的 类 模板 实例化“c10::optional”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=c10::OperatorName
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t”: 已将析构函数隐式定义为“已删除”
with
[
T=at::DimVector
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(367): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t”的引用
with
[
T=at::DimVector
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base”的引用
with
[
T=at::DimVector
]
E:\mmseg\ops\torch\include\c10/util/Optional.h(427): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase”的引用
E:\mmseg\ops\torch\include\ATen/TensorIterator.h(616): note: 查看对正在编译的 类 模板 实例化“c10::optional”的引用
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base”: 已将析构函数隐式定义为“已删除”
with
[
T=at::DimVector
]
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin\nvcc" -c E:\mmseg\ops\src\cuda\ms_deform_attn_cuda.cu -o build\temp.win-amd64-cpython-38\Release\mmseg\ops\src\cuda\ms_de
form_attn_cuda.obj -IE:\mmseg\ops\src -IE:\mmseg\ops\torch\include -IE:\mmseg\ops\torch\include\torch\csrc\api\include -IE:\mmseg\ops\torch\include\TH -IE:\mmseg\ops\torch\include\THC
"-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include" -IE:\Miniconda3lj\envs\openmmlab\include -IE:\Miniconda3lj\envs\openmmlab\Include -IE:\VS\1\VC\Tools\MSVC\14.29.3
0133\ATLMFC\include -IE:\VS\1\VC\Tools\MSVC\14.29.30133\include "-IE:\Windows Kits\10\include\10.0.19041.0\ucrt" "-IE:\Windows Kits\10\include\10.0.19041.0\shared" "-IE:\Windows Kits\
10\include\10.0.19041.0\um" "-IE:\Windows Kits\10\include\10.0.19041.0\winrt" "-IE:\Windows Kits\10\include\10.0.19041.0\cppwinrt" -IE:\VS\1\VC\Tools\MSVC\14.29.30133\include "-IE:\Wi
ndows Kits\10\Include\10.0.19041.0\ucrt" "-IE:\Windows Kits\10\Include\10.0.19041.0\um" "-IE:\Windows Kits\10\Include\10.0.19041.0\cppwinrt" "-IE:\Windows Kits\10\Include\10.0.19041.0
\shared" "-IE:\Windows Kits\10\Include\10.0.19041.0\winrt" -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assum
ed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompil
er /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NOBFLOAT16
CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -DCUDA_HAS_FP16=1 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -D__CUDA_NO_HALF2_OPERATORS__ -DTORC
H_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=MultiScaleDeformableAttention -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --use-local-env
ms_deform_attn_cuda.cu
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(127): error: identifier "grad_output_n" is undefined
warnings.warn(f'Error checking compiler version for {compiler}: {error}') building 'MultiScaleDeformableAttention' extension E:\VS\1\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DWITH_CUDA -IE:\mmseg\ops\src -IE:\mmseg\ops\torch\include -IE:\mmseg\ops\torch\include\t orch\csrc\api\include -IE:\mmseg\ops\torch\include\TH -IE:\mmseg\ops\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include" -IE:\Miniconda3lj\envs\open mmlab\include -IE:\Miniconda3lj\envs\openmmlab\Include -IE:\VS\1\VC\Tools\MSVC\14.29.30133\ATLMFC\include -IE:\VS\1\VC\Tools\MSVC\14.29.30133\include "-IE:\Windows Kits\10\include\10. 0.19041.0\ucrt" "-IE:\Windows Kits\10\include\10.0.19041.0\shared" "-IE:\Windows Kits\10\include\10.0.19041.0\um" "-IE:\Windows Kits\10\include\10.0.19041.0\winrt" "-IE:\Windows Kits\ 10\include\10.0.19041.0\cppwinrt" -IE:\VS\1\VC\Tools\MSVC\14.29.30133\include "-IE:\Windows Kits\10\Include\10.0.19041.0\ucrt" "-IE:\Windows Kits\10\Include\10.0.19041.0\um" "-IE:\Win dows Kits\10\Include\10.0.19041.0\cppwinrt" "-IE:\Windows Kits\10\Include\10.0.19041.0\shared" "-IE:\Windows Kits\10\Include\10.0.19041.0\winrt" /EHsc /TpE:\mmseg\ops\src\cpu\ms_defor m_attn_cpu.cpp /Fobuild\temp.win-amd64-cpython-38\Release\mmseg\ops\src\cpu\ms_deform_attn_cpu.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=MultiScaleDeformableAttention -D_GLIBCXX_USE_CXX11_ABI=0 ms_deform_attn_cpu.cpp E:\mmseg\ops\torch\include\c10/util/Optional.h(183): warning C4624: “c10::constexpr_storage_t
E:\mmseg\ops\torch\include\c10/core/impl/InlineDeviceGuard.h(427): note: 查看对正在编译的 类 模板 实例化“c10::optional<c10::impl::InlineDeviceGuard
E:\mmseg\ops\torch\include\ATen/core/jit_type.h(351): note: 查看对正在编译的 类 模板 实例化“c10::optional<std::vector<c10::ShapeSymbol,std::allocator
E:\mmseg\ops\torch\include\c10/util/Optional.h(395): warning C4624: “c10::trivially_copyable_optimization_optional_base
E:\mmseg\ops\torch\include\c10/core/impl/InlineStreamGuard.h(196): note: 查看对正在编译的 类 模板 实例化“c10::optional<c10::impl::InlineStreamGuard
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: type name is not allowed
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: expected an expression
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: identifier "per_sample_loc_size" is undefined
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: identifier "per_attn_weight_size" is undefined
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: identifier "grad_sampling_loc" is undefined
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: type name is not allowed
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: expected an expression
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: identifier "grad_attn_weight" is undefined
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: type name is not allowed
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: expected an expression
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: no instance of function template "ms_deformable_col2im_cuda" matches the argument list argument types are: (c10::cuda::CUDAStream,, double , int64_t , int64_t , , , const int, const int, const int, const int, const int, const int, const int, double , , )
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: type name is not allowed
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: expected an expression
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: identifier "per_sample_loc_size" is undefined
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: identifier "per_attn_weight_size" is undefined
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: identifier "grad_sampling_loc" is undefined
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: type name is not allowed
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: expected an expression
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: identifier "grad_attn_weight" is undefined
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: type name is not allowed
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: expected an expression
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(128): error: no instance of function template "ms_deformable_col2im_cuda" matches the argument list argument types are: (c10::cuda::CUDAStream,, float , int64_t , int64_t , , , const int, const int, const int, const int, const int, const int, const int, float , , )
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(145): error: identifier "grad_sampling_loc" is undefined
E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(145): error: identifier "grad_attn_weight" is undefined
E:/mmseg/ops/src\cuda/ms_deform_im2col_cuda.cuh(258): warning: variable "q_col" was declared but never referenced detected during: instantiation of "void ms_deformable_im2col_gpu_kernel(int, const scalar_t , const int64_t , const int64_t , const scalar_t , const scalar_t , int, int, int, int, int, int, int, scalar_t ) [with scalar_t=double]" (943): here instantiation of "void ms_deformable_im2col_cuda(cudaStream_t, const scalar_t , const int64_t , const int64_t , const scalar_t , const scalar_t , int, int, int, int, int, int, int, scalar_t ) [with scalar_t=double]" E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(64): here
E:/mmseg/ops/src\cuda/ms_deform_im2col_cuda.cuh(258): warning: variable "q_col" was declared but never referenced detected during: instantiation of "void ms_deformable_im2col_gpu_kernel(int, const scalar_t , const int64_t , const int64_t , const scalar_t , const scalar_t , int, int, int, int, int, int, int, scalar_t ) [with scalar_t=float]" (943): here instantiation of "void ms_deformable_im2col_cuda(cudaStream_t, const scalar_t , const int64_t , const int64_t , const scalar_t , const scalar_t , int, int, int, int, int, int, int, scalar_t ) [with scalar_t=float]" E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu(64): here
25 errors detected in the compilation of "E:/mmseg/ops/src/cuda/ms_deform_attn_cuda.cu". error: command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin\nvcc.exe' failed with exit code 1
是否是因为windows系统编译不了'MultiScaleDeformableAttention'?
2.后来我在网上查了资料,尝试用mmcv模块自带的from mmcv.ops.multi_scale_deform_attn import ext_module as MSDA代替ops\functions\ms_deform_attn_func.py 中的import MultiScaleDeformableAttention as MSDA,在运行训练脚本时,出现错误:
Traceback (most recent call last): File "E:/mmsegmentation-0.20.2/train.py", line 217, in
main()
File "E:/mmsegmentation-0.20.2/train.py", line 206, in main
train_segmentor(
File "E:\mmsegmentation-0.20.2\mmseg\apis\train.py", line 167, in train_segmentor
runner.run(data_loaders, cfg.workflow)
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\mmcv\runner\iter_based_runner.py", line 134, in run
iter_runner(iter_loaders[i], *kwargs)
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\mmcv\runner\iter_based_runner.py", line 67, in train
self.call_hook('after_train_iter')
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\mmcv\runner\base_runner.py", line 309, in call_hook
getattr(hook, fn_name)(self)
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\mmcv\runner\hooks\optimizer.py", line 56, in after_train_iter
runner.outputs['loss'].backward()
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\torch_tensor.py", line 255, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\torch\autograd__init__.py", line 147, in backward
Variable._execution_engine.run_backward(
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\torch\autograd\function.py", line 87, in apply
return self._forward_cls.backward(self, args) # type: ignore[attr-defined]
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\torch\autograd\function.py", line 204, in wrapper
outputs = fn(ctx, args)
File "E:\Miniconda3lj\envs\openmmlab\lib\site-packages\torch\cuda\amp\autocast_mode.py", line 236, in decorate_bwd
return bwd(args, **kwargs)
File "E:\mmseg\ops\functions\ms_deform_attn_func.py", line 42, in backward
MSDA.ms_deform_attn_backward(
TypeError: ms_deform_attn_backward(): incompatible function arguments. The following argument types are supported:
Invoked with: tensor([[[[ 1.0454e+00, 2.3037e+00, 7.8711e-02, ..., -5.2629e-02, -2.0575e+00, 3.8382e-01], [ 4.4317e-01, -1.9688e+00, -7.4302e-01, ..., 1.1384e-01, -2.0322e+00, -9.8970e-01], [-1.4092e+00, 9.1649e-01, 4.5920e-01, ..., 7.8782e-02, 2.3319e-02, 1.0307e+00], ..., [-4.7453e-01, 6.1668e-03, 8.4582e-01, ..., -4.2253e-01, 9.2638e-01, 5.2819e-01], [-5.0433e-02, -1.9279e+00, 8.2762e-02, ..., 5.4080e-01, 5.2500e-01, 2.8486e-01], [-1.0713e+00, -6.2969e-02, 5.8540e-01, ..., 1.4663e+00, -1.4296e+00, -1.2585e+00]],
Process finished with exit code 1
这个问题困扰我很久了,是否只能在linux系统上进行编译,或者说windows上编译也可有别的解决办法?非常感谢!!!