我已经按照 https://github.com/explosion/spaCy/blob/master/examples/training/train_new_entity_type.py训练了模型
我将它保存到某个目录,然后再次加载并使用它。但是当我尝试访问 doc.vector 时加载它后,它会引发以下错误。
Traceback (most recent call last):
File "C:/Users/ankita.a.rath/Desktop/my_codes/Rasa_nlu/rasa_nlu-master/train_spacy_ner.py", line 248, in <module>
main("en", "new_model")
File "C:/Users/ankita.a.rath/Desktop/my_codes/Rasa_nlu/rasa_nlu-master/train_spacy_ner.py", line 238, in main
print (doc2.vector)
File "spacy/tokens/doc.pyx", line 275, in spacy.tokens.doc.Doc.vector.__get__ (spacy/tokens/doc.cpp:7291)
self._vector = sum(t.vector for t in self) / len(self)
File "spacy/tokens/doc.pyx", line 275, in genexpr (spacy/tokens/doc.cpp:7114)
self._vector = sum(t.vector for t in self) / len(self)
File "spacy/tokens/token.pyx", line 240, in spacy.tokens.token.Token.vector.__get__ (spacy/tokens/token.cpp:7249)
raise ValueError(
ValueError: Word vectors set to length 0. This may be because you don't have a model installed or loaded, or because your model doesn't include word vectors. For more info, see the documentation:
https://spacy.io/docs/usage
关于我的环境的信息。
Python版本:2.7.13
平台:Windows-10
spaCy 版本:1.9.0
安装型号:zh
请提出一些解决方案。