flairNLP/flair

ImportError: cannot import name 'TransformerEncoderLayer

JoyHuYY1412 opened this issue · 10 comments

My pytorch is 1.1.0 and python is 3.6.8.

I switch the version to 0.4.3 and the question is not reported.

I also get the ImportError with flair 0.4.4. With flair 0.4.3 everything works fine.

Could you, please, upgrade PyTorch to 1.2.0 (pip install torch==1.2.0) since AFAIK that's the first version that has torch.nn.TransformerEncoderLayer. If that works, we'll just have to bump the PyTorch version in requirements.txt.

I updated PyTorch to the latest version (1.3.0) but unfortunately, I still get the ImportError. I am using Python 3.8.0

Same thing to me, I am using AWS Sagemaker notebooks.
this seams to be a flair 0.4.4 issue, because it all work fine when we force it back to 0.4.3

!pip install flair==0.4.3

@robertodias have you tried setting torch to 1.2.0?

99991 commented

Curiously, I had the same issue with torch==1.2.0 and flair==0.4.4 but it works with torch==1.3.0.

torch==1.2.0 and flair==0.4.4 work for me.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

same problem here. Pytorch 1.10.2 and python 3.6