解决pytorch1.9版本中的Userwarning报错

问题描述

在做深度学习网络训练的时候,有以下错误:

/root/miniconda3/lib/python3.8/site-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at  /pytorch/c10/core/TensorImpl.h:1156.)

用户警告:命名张量及其所有相关 API 是一项试验性功能,可能会发生变化。在这些功能的稳定版本发布之前,请不要将它们用于任何重要的事情。

解决方案

这是pytorch1.9的bug,下个版本将修复,将pytorch降级成1.8就不报错了。

(1)卸载pytorch

pip uninstall torch

(2)安装1.8.0版本的pytorch

pytorch网站链接:Previous PyTorch Versions | PyTorch

找到1.8.0版本

conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch

猜你喜欢

转载自blog.csdn.net/qq_54708219/article/details/129759848
今日推荐