'LSTM' object has no attribute '_flat_weights_names'

Viewed 2709

While executing iNltk library, I am getting an error. I have latest versions of pytorch and torchvision.

'LSTM' object has no attribute '_flat_weights_names'

After re-searching on some blogs some people suggested to downgrade the version to 1.2 So i tried below installation from 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

However, getting errors

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

Also, 1.3.1 version is missing.

Anybody has any idea about how to downgrade to 1.3.1 or 1.2.0?

Thanks in advance

PD

2 Answers

I tried using pip, but that did not work for me. conda fixed the issue.

Setup a conda environment first and activate it. Install iNLTK using pip in conda as follows:

pip install inltk

Remove the version of PyTorch installed as a dependency for iNLTK.

pip uninstall torch

Install the desired version of PyTorch.

conda install pytorch==1.3.0 -c pytorch

Refer: Previous PyTorch Versions

In google colaboratory,I got the same error while executing iNltk library. In Inltk Installation (https://inltk.readthedocs.io/en/latest/api_docs.html) they have provided as:

!pip install torch==1.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

!pip install inltk

but the actual order of implementation is:

!pip install inltk

!pip install torch==1.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html.

So by reversing order of execution of installation,solved error as the torch version gets corrected by following this order.

Related