Error while loading vector from Glove in Spacy
Question:
I am facing the following attribute error when loading glove model:
Code used to load model:
nlp = spacy.load('en_core_web_sm')
tokenizer = spacy.load('en_core_web_sm', disable=['tagger','parser', 'ner', 'textcat'])
nlp.vocab.vectors.from_glove('../models/GloVe')
Getting the following atribute error when trying to load the glove model:
AttributeError: 'spacy.vectors.Vectors' object has no attribute 'from_glove'
Have tried to search on StackOverflow and elsewhere but can’t seem to find the solution. Thanks!
From pip list:
- spacy version: 3.1.4
- spacy-legacy 3.0.8
- en-core-web-sm 3.1.0
Answers:
spacy version: 3.1.4
does not have the feature from_glove
.
I was able to use nlp.vocab.vectors.from_glove()
in spacy version: 2.2.4
.
If you want, you can change your spacy version by using:
!pip install spacy==2.2.4
on your Jupyter cell.
Use spacy init vectors
to load vectors from word2vec/glove text format into a new pipeline: https://spacy.io/api/cli#init-vectors
I am facing the following attribute error when loading glove model:
Code used to load model:
nlp = spacy.load('en_core_web_sm')
tokenizer = spacy.load('en_core_web_sm', disable=['tagger','parser', 'ner', 'textcat'])
nlp.vocab.vectors.from_glove('../models/GloVe')
Getting the following atribute error when trying to load the glove model:
AttributeError: 'spacy.vectors.Vectors' object has no attribute 'from_glove'
Have tried to search on StackOverflow and elsewhere but can’t seem to find the solution. Thanks!
From pip list:
- spacy version: 3.1.4
- spacy-legacy 3.0.8
- en-core-web-sm 3.1.0
spacy version: 3.1.4
does not have the feature from_glove
.
I was able to use nlp.vocab.vectors.from_glove()
in spacy version: 2.2.4
.
If you want, you can change your spacy version by using:
!pip install spacy==2.2.4
on your Jupyter cell.
Use spacy init vectors
to load vectors from word2vec/glove text format into a new pipeline: https://spacy.io/api/cli#init-vectors