Flair: ImportError: cannot import name 'TransformerEncoderLayer

Created on 22 Oct 2019  路  9Comments  路  Source: flairNLP/flair

My pytorch is 1.1.0 and python is 3.6.8.

question wontfix

Most helpful comment

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

All 9 comments

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?

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.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ciaochiaociao picture ciaochiaociao  路  3Comments

jewl123 picture jewl123  路  3Comments

Aditya715 picture Aditya715  路  3Comments

aschmu picture aschmu  路  3Comments

frtacoa picture frtacoa  路  3Comments