PyTorchKey already registered with the same priority: GroupSpatialSoftmax 解决方法

Posted ZSYL

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PyTorchKey already registered with the same priority: GroupSpatialSoftmax 解决方法相关的知识,希望对你有一定的参考价值。

Key already registered with the same priority: GroupSpatialSoftmax

问题描述

记得之前安装PyTorchGPU版本安装成功了 PyTorch 最新安装教程(2021-07-27)

可最近使用GPU时,发现为False不可用!

import torch
torch.cuda.is_available()

原因分析

可能是最近在PyCharm中安装torchtext模块时,附带安装PyTorch-CPU版本,因此覆盖掉原来的GPU版本,两个版本的torch folder名字重合了,conda安装和pycharm安装包其在运行程序的时优先级上起了冲突,因此报错!

解决方法

进入Anaconda中使用的环境:

activate virtualEnvs

1.将两个版本的torch全部卸载,否则可以成功Import torch,但实际上无法运行。

# 需要跑两次pip uninstall
pip uninstall torch 

2.重新安装所需要的版本

conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

参考:Link


加油!

感谢!

努力!

以上是关于PyTorchKey already registered with the same priority: GroupSpatialSoftmax 解决方法的主要内容,如果未能解决你的问题,请参考以下文章

EventBus 报“Subscriber class already registered to event class”错误

文档中的 Dojo 示例因“id is already registered”错误而失败

Deepin 20 系统error:driver pcspkr is already registered aborting

Deepin 20 系统error:driver pcspkr is already registered aborting

VirtualBox 导入vdi时报错 Cannot register the hard disk because a hard disk '' with UUID already e

zookeeper正常,kafka总是挂掉的问题:A broker is already registered on the path /brokers/ids/0.