TimDettmers / spodernet

NLP
MIT License
14 stars 10 forks source link

Improve compatibility with later version of spaCy (>= 3.0) #7

Closed Bluesbreaker45 closed 2 years ago

Bluesbreaker45 commented 2 years ago

SOLUTION before merging: After running step 2 of Installation of ConvE(pip install -r requirements.txt), modify the python code in ConvE/src/spodernet according to the "Files changed" in this PR.

Traceback (most recent call last):
  File "main.py", line 16, in <module>
    from spodernet.preprocessing.pipeline import Pipeline, DatasetStreamer
  File "/root/ConvE/src/spodernet/spodernet/preprocessing/pipeline.py", line 11, in <module>
    from spodernet.preprocessing.processors import SaveLengthsToState
  File "/root/ConvE/src/spodernet/spodernet/preprocessing/processors.py", line 20, in <module>
    nlp = spacy.load('en')
  File "/root/anaconda3/lib/python3.8/site-packages/spacy/__init__.py", line 54, in load
    return util.load_model(
  File "/root/anaconda3/lib/python3.8/site-packages/spacy/util.py", line 435, in load_model
    raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name]))  # type: ignore[index]
OSError: [E941] Can't find model 'en'. It looks like you're trying to load a model from a shortcut, which is obsolete as of spaCy v3.0. To load the model, use its full name instead:

nlp = spacy.load("en_core_web_sm")

For more details on the available models, see the models directory: https://spacy.io/models. If you want to create a blank model, use spacy.blank: nlp = spacy.blank("en")
(pytorch) root@host:~/ConvE# python -m spacy download en
⚠ As of spaCy v3.0, shortcuts like 'en' are deprecated. Please use the
full pipeline package name 'en_core_web_sm' instead.

It said that the updated version of spaCy does not support shortcuts (said in line: 18 of the output).

There are 2 occurrences where the invalid shortcut is used, and I fixed them.

TimDettmers commented 2 years ago

Thank you :)