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

一、前言

最近在跑关键点预测的网络,不出意外环境都要经过报错,这次直接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

猜你喜欢

转载自blog.csdn.net/SL1029_/article/details/131861230