'M2M100Tokenizer.from_pretrained 'NoneType' object is not callable
I have the following chunk of code from this link:
from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
hi_text = "जीवन एक चॉकलेट बॉक्स की तरह है।"
chinese_text = "生活就像一盒巧克力。"
model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M")
Which gives me the following error:
TypeError Traceback (most recent call last)
<ipython-input-13-c56f34229c4a> in <module>()
5
6 model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
----> 7 tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M")
TypeError: 'NoneType' object is not callable
I'm using Google Colab, but funnily enough it works perfectly fine in VSCode.
Solution 1:[1]
Same here, it works fine in my local env but not on colab, I fixed this by using transformers==4.16.0 instead of the latest version, it was chosen arbitrarily however, it may work with a more recent one
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | malloc |