运行RDPN6D报错:terminate called after throwing an instance of ‘c10::Error‘

 what():  !dispatch_key_.has_value() INTERNAL ASSERT FAILED at "../aten/src/ATen/core/library.cpp":82, please report a bug to PyTorch. (Error occurred while processing TORCH_LIBRARY block at RDPN6D/detectron2/detectron2/layers/csrc/vision.cpp:111)

最近题主在复现算法时有如上报错,因为报错末尾处出现 <omitting python frames>(core dumped)两个提示,让我一开始以为是CPU相关的错误,因为运行代码时CPU占用率相当高,完整报错如下:

terminate called after throwing an instance of 'c10::Error'
  what():  !dispatch_key_.has_value() INTERNAL ASSERT FAILED at "../aten/src/ATen/core/library.cpp":82, please report a bug to PyTorch. (Error occurred while processing TORCH_LIBRARY block at RDPN6D/detectron2/detectron2/layers/csrc/vision.cpp:111)
Exception raised from Library at ../aten/src/ATen/core/library.cpp:82 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::string) + 0x57 (0x7fa374845d87 in /home/jqr/anaconda3/envs/rdpn/lib/python3.9/site-packages/torch/lib/libc10.so)
frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::string const&) + 0x64 (0x7fa3747f675f in /home/jqr/anaconda3/envs/rdpn/lib/python3.9/site-packages/torch/lib/libc10.so)
frame #2: c10::detail::torchInternalAssertFail(char const*, char const*, unsigned int, char const*, std::string const&) + 0x3f (0x7fa3748438bf in /home/jqr/anaconda3/envs/rdpn/lib/python3.9/site-packages/torch/lib/libc10.so)
frame #3: torch::Library::Library(torch::Library::Kind, std::string, std::optional<c10::DispatchKey>, char const*, unsigned int) + 0x96c (0x7fa3ac70620c in /home/jqr/anaconda3/envs/rdpn/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so)
frame #4: <unknown function> + 0x187cc (0x7fa16c1d17cc in /home/jqr/data/cwl/RDPN6D/detectron2/detectron2/_C.cpython-39-x86_64-linux-gnu.so)
frame #5: <unknown function> + 0xf38a (0x7fa3c6d5d38a in /lib64/ld-linux-x86-64.so.2)
frame #6: <unknown function> + 0xf486 (0x7fa3c6d5d486 in /lib64/ld-linux-x86-64.so.2)
frame #7: <unknown function> + 0x132e3 (0x7fa3c6d612e3 in /lib64/ld-linux-x86-64.so.2)
frame #8: _dl_catch_exception + 0x6f (0x7fa3c681f8cf in /lib/x86_64-linux-gnu/libc.so.6)
frame #9: <unknown function> + 0x12bca (0x7fa3c6d60bca in /lib64/ld-linux-x86-64.so.2)
frame #10: <unknown function> + 0x1256 (0x7fa3c6a40256 in /lib/x86_64-linux-gnu/libdl.so.2)
frame #11: _dl_catch_exception + 0x6f (0x7fa3c681f8cf in /lib/x86_64-linux-gnu/libc.so.6)
frame #12: _dl_catch_error + 0x2f (0x7fa3c681f95f in /lib/x86_64-linux-gnu/libc.so.6)
frame #13: <unknown function> + 0x1995 (0x7fa3c6a40995 in /lib/x86_64-linux-gnu/libdl.so.2)
frame #14: dlopen + 0x46 (0x7fa3c6a402e6 in /lib/x86_64-linux-gnu/libdl.so.2)
<omitting python frames>

已放弃 (core dumped)

经过进一步探索发现还可能与代码中torch的nn.Embedding(size,char_len)函数中size有关,如pytorch使用时遇到的坑(一)_terminate called after throwing an instance of 'c1-CSDN博客。但经检查后题主的报错和这个函数无关,因为我的错误在what():  !dispatch_key_.has_value() INTERNAL ASSERT FAILED at "../aten/src/ATen/core/library.cpp":82, please report a bug to PyTorch.于是便继续深究,发现错误大概率出现在torch的版本上https://github.com/pytorch/pytorch/issues/102452,抱着尝试的心态卸掉了2.2.1+cu118版本的torch和对应的torchvision、torchaudio,并安装了2.0.0版本的torch。

pip install torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu118

最终问题成功解决!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值