Невозможно загрузить английский в просторах в Windows - PullRequest
1 голос
/ 03 июля 2019

Я успешно установил spacy в Windows, но когда я загружаю spacy в ноутбук jupyter, я получаю сообщение об ошибке

ValueError: could not broadcast input array from shape (96) into shape (128)

Я проверил проверку пакетов в терминале jupyter следующим образом

python -m spacy validate
✔ Loaded compatibility table

====================== Installed models (spaCy v2.1.4) ======================
ℹ spaCy installation:
C:\Users\iKhan\AppData\Roaming\Python\Python36\site-packages\spacy

TYPE      NAME             MODEL            VERSION
package   en-core-web-sm   en_core_web_sm   2.1.0     ✔
package   en-core-web-md   en_core_web_md   2.1.0     ✔
package   en-core-web-lg   en_core_web_lg   2.1.0     ✔

Я пытаюсь импортировать в блокнот Jupyter

import spacy
nlp = spacy.load('en_core_web_sm', disable=['parser', 'ner'])


 Error 
        ValueError: could not broadcast input array from shape (96) into shape (128)

Ниже приводится полный список ошибок

'''
ValueError                                Traceback (most recent call last)
<ipython-input-91-2ffa9ed657fb> in <module>
      7 import en_core_web_sm
      8 #nlp = en_core_web_sm.load()
----> 9 nlp = spacy.load('en_core_web_sm', disable=['parser', 'ner'])

~\Anaconda3\envs\nlp_course\lib\site-packages\spacy\__init__.py in load(name, **overrides)
     19     if depr_path not in (True, False, None):
     20         deprecation_warning(Warnings.W001.format(path=depr_path))
---> 21     return util.load_model(name, **overrides)
     22 
     23 

~\Anaconda3\envs\nlp_course\lib\site-packages\spacy\util.py in load_model(name, **overrides)
    112             return load_model_from_link(name, **overrides)
    113         if is_package(name):  # installed as package
--> 114             return load_model_from_package(name, **overrides)
    115         if Path(name).exists():  # path to model data directory
    116             return load_model_from_path(Path(name), **overrides)

~\Anaconda3\envs\nlp_course\lib\site-packages\spacy\util.py in load_model_from_package(name, **overrides)
    133     """Load a model from an installed package."""
    134     cls = importlib.import_module(name)
--> 135     return cls.load(**overrides)
    136 
    137 

~\Anaconda3\envs\nlp_course\lib\site-packages\en_core_web_sm\__init__.py in load(**overrides)
     10 
     11 def load(**overrides):
---> 12     return load_model_from_init_py(__file__, **overrides)

~\Anaconda3\envs\nlp_course\lib\site-packages\spacy\util.py in load_model_from_init_py(init_file, **overrides)
    171     if not model_path.exists():
    172         raise IOError(Errors.E052.format(path=path2str(data_path)))
--> 173     return load_model_from_path(data_path, meta, **overrides)
    174 
    175 

~\Anaconda3\envs\nlp_course\lib\site-packages\spacy\util.py in load_model_from_path(model_path, meta, **overrides)
    154             component = nlp.create_pipe(name, config=config)
    155             nlp.add_pipe(component, name=name)
--> 156     return nlp.from_disk(model_path)
    157 
    158 

~\Anaconda3\envs\nlp_course\lib\site-packages\spacy\language.py in from_disk(self, path, disable)
    645         if not (path / 'vocab').exists():
    646             exclude['vocab'] = True
--> 647         util.from_disk(path, deserializers, exclude)
    648         self._path = path
    649         return self

~\Anaconda3\envs\nlp_course\lib\site-packages\spacy\util.py in from_disk(path, readers, exclude)
    509     for key, reader in readers.items():
    510         if key not in exclude:
--> 511             reader(path / key)
    512     return path
    513 

~\Anaconda3\envs\nlp_course\lib\site-packages\spacy\language.py in <lambda>(p, proc)
    641             if not hasattr(proc, 'to_disk'):
    642                 continue
--> 643             deserializers[name] = lambda p, proc=proc: proc.from_disk(p, vocab=False)
    644         exclude = {p: False for p in disable}
    645         if not (path / 'vocab').exists():

pipeline.pyx in spacy.pipeline.Tagger.from_disk()

~\Anaconda3\envs\nlp_course\lib\site-packages\spacy\util.py in from_disk(path, readers, exclude)
    509     for key, reader in readers.items():
    510         if key not in exclude:
--> 511             reader(path / key)
    512     return path
    513 

pipeline.pyx in spacy.pipeline.Tagger.from_disk.load_model()

pipeline.pyx in spacy.pipeline.Tagger.from_disk.load_model()

~\Anaconda3\envs\nlp_course\lib\site-packages\thinc\neural\_classes\model.py in from_bytes(self, bytes_data)
    350     def from_bytes(self, bytes_data):
    351         data = srsly.msgpack_loads(bytes_data)
--> 352         weights = data[b"weights"]
    353         queue = [self]
    354         i = 0

~\Anaconda3\envs\nlp_course\lib\site-packages\thinc\neural\util.py in copy_array(dst, src, casting, where)
     68 
     69 def require_gpu():
---> 70     from ._classes.model import Model
     71     from .ops import CupyOps
     72 

ValueError: could not broadcast input array from shape (96) into shape (128)
'''
...