В настоящее время я работаю над spaCy в редакторе Spyder3.
Но после первого запуска ниже простой код.Это дает мне ошибку
"PicklingError: Could not pickle object as excessively deep recursion required."
Не могли бы вы помочь мне решить проблему?Я пропускаю какой-либо дополнительный код или настройки?
Спасибо,
Сол
Я мог бы запустить код без проблем на ноутбуке jupyter, но он не работает на Spyder3.
import spacy
nlp = spacy.load('en_core_web_sm')
Он должен работать без ошибок.
Я уже установил 'en_core_web_sm'
Я не уверен, в чем проблема.
, пожалуйста, найдите полное сообщение об ошибке ниже.
Reloaded modules: __mp_main__, spacy, thinc, thinc.about, thinc.neural, thinc.neural._classes, thinc.neural._classes.model, srsly, srsly._json_api, srsly.ujson, srsly.ujson.ujson, srsly.util, srsly._msgpack_api, srsly.msgpack, srsly.msgpack._version, srsly.msgpack.exceptions, srsly.msgpack._packer, srsly.msgpack._unpacker, srsly.msgpack._ext_type, srsly.msgpack._msgpack_numpy, srsly._pickle_api, srsly.cloudpickle, srsly.cloudpickle.cloudpickle, thinc.neural.util, thinc.neural.train, tqdm, tqdm._tqdm, tqdm._utils, tqdm._monitor, tqdm._tqdm_gui, tqdm._tqdm_pandas, tqdm._main, tqdm._version, thinc.neural.optimizers, thinc.neural.ops, thinc.neural.mem, thinc.check, thinc.compat, thinc.extra, thinc.extra.wrapt, thinc.extra.wrapt.wrappers, thinc.extra.wrapt._wrappers, thinc.extra.wrapt.decorators, thinc.extra.wrapt.importer, thinc.exceptions, wasabi, wasabi.printer, wasabi.tables, wasabi.util, wasabi.traceback, spacy.cli, spacy.cli.download, plac, plac_core, plac_ext, spacy.cli.link, spacy.compat, spacy.util, pkg_resources, pkg_resources.extern, pkg_resources._vendor, pkg_resources.extern.six, pkg_resources.py31compat, pkg_resources.extern.appdirs, pkg_resources._vendor.packaging.__about__, pkg_resources.extern.packaging, pkg_resources.extern.packaging.version, pkg_resources.extern.packaging._structures, pkg_resources.extern.packaging.specifiers, pkg_resources.extern.packaging._compat, pkg_resources.extern.packaging.requirements, pkg_resources.extern.pyparsing, pkg_resources.extern.packaging.markers, jsonschema, jsonschema.exceptions, attr, attr.converters, attr._make, attr._config, attr._compat, attr.exceptions, attr.filters, attr.validators, attr._funcs, jsonschema._utils, jsonschema.compat, jsonschema._format, jsonschema._types, pyrsistent, pyrsistent._pmap, pyrsistent._compat, pyrsistent._pvector, pyrsistent._transformations, pvectorc, pyrsistent._pset, pyrsistent._pbag, pyrsistent._plist, pyrsistent._pdeque, pyrsistent._checked_types, pyrsistent._field_common, pyrsistent._precord, pyrsistent._pclass, pyrsistent._immutable, pyrsistent._helpers, pyrsistent._toolz, jsonschema.validators, jsonschema._legacy_validators, jsonschema._validators, spacy.symbols, spacy.errors, spacy.about, spacy.cli.info, spacy.cli.package, spacy.cli.profile, thinc.extra.datasets, thinc.extra._vendorized, thinc.extra._vendorized.keras_data_utils, thinc.extra._vendorized.keras_generic_utils, spacy.cli.train, spacy._ml, thinc.v2v, thinc.neural._classes.affine, thinc.describe, thinc.neural._classes.relu, thinc.neural._classes.maxout, thinc.neural._classes.softmax, thinc.neural._classes.selu, thinc.i2v, thinc.neural._classes.hash_embed, thinc.neural._lsuv, thinc.neural._classes.embed, thinc.neural._classes.static_vectors, thinc.extra.load_nlp, thinc.t2t, thinc.neural._classes.convolution, thinc.neural._classes.attention, thinc.neural._classes.rnn, thinc.api, thinc.neural._classes.function_layer, thinc.neural._classes.feed_forward, thinc.t2v, thinc.neural.pooling, thinc.misc, thinc.neural._classes.batchnorm, thinc.neural._classes.layernorm, thinc.neural._classes.resnet, thinc.neural._classes.feature_extracter, thinc.linear, thinc.linear.linear, spacy.attrs, spacy.gold, spacy.cli.pretrain, spacy.tokens, spacy.tokens.doc, spacy.tokens.token, spacy.tokens.span, spacy.cli.debug_data, spacy.cli.evaluate, spacy.displacy, spacy.displacy.render, spacy.displacy.templates, spacy.cli.convert, spacy.cli.converters, spacy.cli.converters.conllu2json, spacy.cli.converters.iob2json, spacy.cli.converters.conll_ner2json, spacy.cli.converters.jsonl2json, spacy.cli.init_model, preshed, preshed.about, preshed.counter, spacy.vectors, spacy.cli.validate, spacy.glossary
Traceback (most recent call last):
File "<ipython-input-5-e0e768bc0aee>", line 1, in <module>
runfile('/home/saul/pythontraining/NLP/itemWork_3.py', wdir='/home/saul/pythontraining/NLP')
File "/home/saul/anaconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 786, in runfile
execfile(filename, namespace)
File "/home/saul/anaconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "/home/saul/pythontraining/NLP/itemWork_3.py", line 11, in <module>
nlp = spacy.load('en_core_web_sm')
File "/home/saul/.local/lib/python3.7/site-packages/spacy/__init__.py", line 27, in load
return util.load_model(name, **overrides)
File "/home/saul/.local/lib/python3.7/site-packages/spacy/util.py", line 131, in load_model
return load_model_from_package(name, **overrides)
File "/home/saul/.local/lib/python3.7/site-packages/spacy/util.py", line 152, in load_model_from_package
return cls.load(**overrides)
File "/home/saul/anaconda3/lib/python3.7/site-packages/en_core_web_sm/__init__.py", line 12, in load
return load_model_from_init_py(__file__, **overrides)
File "/home/saul/.local/lib/python3.7/site-packages/spacy/util.py", line 190, in load_model_from_init_py
return load_model_from_path(data_path, meta, **overrides)
File "/home/saul/.local/lib/python3.7/site-packages/spacy/util.py", line 173, in load_model_from_path
return nlp.from_disk(model_path)
File "/home/saul/.local/lib/python3.7/site-packages/spacy/language.py", line 791, in from_disk
util.from_disk(path, deserializers, exclude)
File "/home/saul/.local/lib/python3.7/site-packages/spacy/util.py", line 630, in from_disk
reader(path / key)
File "/home/saul/.local/lib/python3.7/site-packages/spacy/language.py", line 787, in <lambda>
deserializers[name] = lambda p, proc=proc: proc.from_disk(p, exclude=["vocab"])
File "pipes.pyx", line 617, in spacy.pipeline.pipes.Tagger.from_disk
File "/home/saul/.local/lib/python3.7/site-packages/spacy/util.py", line 630, in from_disk
reader(path / key)
File "pipes.pyx", line 599, in spacy.pipeline.pipes.Tagger.from_disk.load_model
File "pipes.pyx", line 512, in spacy.pipeline.pipes.Tagger.Model
File "/home/saul/.local/lib/python3.7/site-packages/spacy/_ml.py", line 513, in build_tagger_model
pretrained_vectors=pretrained_vectors,
File "/home/saul/.local/lib/python3.7/site-packages/spacy/_ml.py", line 363, in Tok2Vec
embed >> convolution ** conv_depth, pad=conv_depth
File "/home/saul/.local/lib/python3.7/site-packages/thinc/check.py", line 131, in checker
return wrapped(*args, **kwargs)
File "/home/saul/.local/lib/python3.7/site-packages/thinc/neural/_classes/model.py", line 281, in __pow__
return self._operators["**"](self, other)
File "/home/saul/.local/lib/python3.7/site-packages/thinc/api.py", line 117, in clone
layers.append(copy.deepcopy(orig))
File "/home/saul/anaconda3/lib/python3.7/copy.py", line 169, in deepcopy
rv = reductor(4)
File "/home/saul/.local/lib/python3.7/site-packages/thinc/neural/_classes/model.py", line 96, in __getstate__
return srsly.pickle_dumps(self.__dict__)
File "/home/saul/.local/lib/python3.7/site-packages/srsly/_pickle_api.py", line 14, in pickle_dumps
return cloudpickle.dumps(data, protocol=protocol)
File "/home/saul/.local/lib/python3.7/site-packages/srsly/cloudpickle/cloudpickle.py", line 954, in dumps
cp.dump(obj)
File "/home/saul/.local/lib/python3.7/site-packages/srsly/cloudpickle/cloudpickle.py", line 288, in dump
raise pickle.PicklingError(msg)
PicklingError: Could not pickle object as excessively deep recursion required.