Reputation: 2111
Trying to run this TextualHeatmap example, we encounter 'TFEmbeddings' object has no attribute 'word_embeddings'
error in the following code snippet from the HuggingFace transformers library. Any help is appreciated.
from transformers import TFDistilBertForMaskedLM, DistilBertTokenizer
dbert_model = TFDistilBertForMaskedLM.from_pretrained('distilbert-base-uncased')
dbert_tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-uncased')
dbert_embmat = dbert_model.distilbert.embeddings.word_embeddings
Upvotes: 0
Views: 2616
Reputation: 105
Downgrading the version of transformers will work.
pip install transformers==3.1.0
Upvotes: 0
Reputation: 1071
Try to use '.weight' instead of '.word_embeddings' as per hugging face latest implementation. It works for me.
Upvotes: 1