explosion / spaCy

💫 Industrial-strength Natural Language Processing (NLP) in Python
https://spacy.io
MIT License
29.82k stars 4.37k forks source link

tok2vec missing #4416

Closed davidbren closed 3 years ago

davidbren commented 5 years ago

How to reproduce the behaviour

I upgraded my local spaCy version from 2.0.18 to 2.1.18

I built a custom model NER model on a unix box which also has spaCy 2.1.18 In order to visually debug it I copy the model over to my local environment

When I run the following line ner_model = spacy.load(modelDir)

It throws a file not found error on C:\myModel\ner\tok2vec_model

In older version 2.0.8 when I had build models it did produce the above file but it seems this has changed & but the install has copied the necessary files when I upgraded

Error Stack is

File "C:\Python36\lib\site-packages\spacy__init__.py", line 21, in load return util.load_model(name, overrides) File "C:\Python36\lib\site-packages\spacy\util.py", line 116, in load_model return load_model_from_path(Path(name), overrides) File "C:\Python36\lib\site-packages\spacy\util.py", line 156, in load_model_from_path return nlp.from_disk(model_path) File "C:\Python36\lib\site-packages\spacy\language.py", line 647, in from_disk util.from_disk(path, deserializers, exclude) File "C:\Python36\lib\site-packages\spacy\util.py", line 511, in from_disk reader(path / key) File "C:\Python36\lib\site-packages\spacy\language.py", line 643, in deserializers[name] = lambda p, proc=proc: proc.from_disk(p, vocab=False) File "nn_parser.pyx", line 912, in spacy.syntax.nn_parser.Parser.from_disk File "C:\Python36\lib\pathlib.py", line 1162, in open opener=self._opener) File "C:\Python36\lib\pathlib.py", line 1016, in _opener return self._accessor.open(self, flags, mode) File "C:\Python36\lib\pathlib.py", line 388, in wrapped return strfunc(str(pathobj), *args) FileNotFoundError: [Errno 2] No such file or directory: 'C:\myModel\ner\tok2vec_model'

Your Environment

svlandeg commented 5 years ago

Hi @davidbren, I'm not sure I fully understand the path that led you to this problem. You mention an upgrade of spaCy, but the model was trained on the new version? Are you 100% sure the path specification remains correct after moving the model to a different machine? Have you checked whether C:\myModel\ner\tok2vec_model indeed exists or not (both on the old and new machine)?

davidbren commented 5 years ago

Hi

Thanks for the quick reply. I created the model on a more powerful Unix box, this has spaCy 2.1.18. I then move this model on to my local system so that I can visually trace the code via pycharm. To make sure it's like for like I upgraded my local spaCy version to 2.1.18 also. Then when I try to load model I get that error. The path specification is correct I double checked. The file C:\myModel\ner\tok2vec_model doesn't exist but it still loads ok on Unix box so that's what makes me think that the upgrade I did locally isn't quiet right. Yesterday I tried copying some of the files from my Unix install to local files such as language.py but that didn't remedy either.

Also when upgrading from 2.0.18 I couldn't go to 2.1.18 directly as it throw an error on blue.py. Tried a manual delete of all spaCy files too but no good

On Thu 10 Oct 2019, 10:01 Sofie Van Landeghem, notifications@github.com wrote:

Hi @davidbren https://github.com/davidbren, I'm not sure I fully understand the path that led you to this problem. You mention an upgrade of spaCy, but the model was trained on the new version? Are you 100% sure the path specification remains correct after moving the model to a different machine? Have you checked whether C:\myModel\ner\tok2vec_model indeed exists or not (both on the old and new machine)?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/explosion/spaCy/issues/4416?email_source=notifications&email_token=AIXKE2AKQIC5DMM5OAIKZ23QN3VPDA5CNFSM4I675F42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEA3PG6Q#issuecomment-540472186, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXKE2BRFB4YOQYDUCZGQRLQN3VPDANCNFSM4I675F4Q .

svlandeg commented 3 years ago

Apologies for the late follow-up. It does sound like something may have gone wrong inbetween installations, and models are often not backward compatible. It's probably a good idea to retrain your model for the newer spaCy version?

FYI - if you feel like some experimenting - the pre-release of spaCy v3 was published just yesterday. If you want to use all the new features of v3 (https://nightly.spacy.io/) I would definitely recommend giving this a spin. The new config system also makes it much more transparent how your models are composed etc.

I'll close this in the meantime, but do let us know if you're still having problems, or feel free to open a new issue.

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.