import torch报错Key already registered with the same priority: GroupSpatialSoftmax

文章讲述了在运行关键点预测网络时遇到的torch导入错误,具体为Keyalreadyregisteredwiththesamepriority:GroupSpatialSoftmax。问题由重复卸载安装torch引起,解决方案是彻底卸载后重新安装。在安装过程中又遇到了torchvision.io.image.pyd加载失败和OpenMP库重复初始化的问题,分别提供了相关博客链接作为解决这两个问题的参考。
摘要由CSDN通过智能技术生成

一、前言

最近在跑关键点预测的网络,不出意外环境都要经过报错,这次直接import torch都报错了

具体报错信息如下:

Key already registered with the same priority: GroupSpatialSoftmax 

二、解决方法

问题原因:博主提到是由于重复卸载安装导致的,确实我个人确实是有重复安装卸载这个操作的。

解决方法很简单:输入两次pip uninstall torch,再重新安装即可

我使用的版本安装命令:

pip install torch==1.10.1+cu102 torchvision==0.11.2+cu102 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu102/torch_stable.html

但报了其他的错误,具体有两个

(1)第一个报错

C:\Users\user_name\anaconda3\envs\HRNet\lib\site-packages\torchvision\io\image.py:11: UserWarning: Failed to load image Python extension: Could not find module 'C:\Users\user_name\anaconda3\envs\HRNet\Lib\site-packages\torchvision\image.pyd' (or one of its dependencies). Try using the full path with constructor syntax.
  warn(f"Failed to load image Python extension: {e}")

这个报错解决方法可以看我这篇博客

(2)第二个报错

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

这个报错很熟悉了,可以看我这篇博客

参考博客

1.(完全解决)Key already registered with the same priority: GroupSpatialSoftmax

2.Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.

3.torch 不能顺利导入torchvision

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值