I am trying to follow the example mentioned in Longformer .
import tensorflow as tf
from transformers import LongformerTokenizer, TFLongformerForMaskedLM
I get below error:
ImportError Traceback (most recent call last)
in
1 import tensorflow as tf
----> 2 from transformers import LongformerTokenizer, TFLongformerForMaskedLM
ImportError: cannot import name ‘TFLongformerForMaskedLM’
How to resolve this? Pls let me know.
Thanks,
Jung
November 4, 2020, 7:02am
2
Maybe you should check if you have the latest version of Huggingface Transformers. (i.e. 3.4.0)
I can import it without any problem
Thanks for replying.
!pip freeze | grep transformers
transformers==3.4.0
And, I still get the same error
import tensorflow as tf
from transformers import LongformerTokenizer, TFLongformerForMaskedLM
ImportError Traceback (most recent call last)
in
1 import tensorflow as tf
----> 2 from transformers import LongformerTokenizer, TFLongformerForMaskedLM
ImportError: cannot import name ‘TFLongformerForMaskedLM’
Jung
November 4, 2020, 11:11pm
4
I have no idea why you did get this import error.
Maybe you can re-check with my dummy Colab in the 2nd cell with showing successfully creating the model.
(The 3rd to last cells are not related to TFLongformer, please ignore)