首页 > 解决方案 > “LSTM”对象没有属性“_flat_weights_names”

问题描述

执行 iNltk 库时,出现错误。我有最新版本的 pytorch 和 torchvision。

'LSTM' object has no attribute '_flat_weights_names'

在重新搜索了一些博客后,有人建议将版本降级到 1.2 所以我尝试从https://pytorch.org/get-started/previous-versions/下面安装

pip install torch==1.2.0+cu92 torchvision==0.4.0+cu92 -f https://download.pytorch.org/whl/torch_stable.html

但是,得到错误

ERROR: Could not find a version that satisfies the requirement torch==1.2.0+cpu
ERROR: No matching distribution found for torch==1.2.0+cpu

此外,缺少 1.3.1 版本。

有人知道如何降级到 1.3.1 或 1.2.0 吗?

提前致谢

PD

标签: pythonpytorchnltktorch

解决方案


我尝试使用pip,但这对我不起作用。conda解决了这个问题。

首先设置conda环境并激活它。iNLTK使用pipin安装conda如下:

pip install inltk

删除作为iNLTK.

pip uninstall torch

安装所需版本的 PyTorch。

conda install pytorch==1.3.0 -c pytorch

参考:以前的 PyTorch 版本


推荐阅读