pythonpython-3.xnlpspacystanford-nlp

Error while loading vector from Glove in Spacy


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:


Solution

  • Use spacy init vectors to load vectors from word2vec/glove text format into a new pipeline: https://spacy.io/api/cli#init-vectors