ImportError: cannot import name 'SpacyTokenizer'
minhson-kaist opened this issue · 2 comments
Hi,
I follow the instruction and I got the following error:
2020-03-11 17:10:55,134 - INFO - pytorch_pretrained_bert.modeling - Better speed can be achieved with apex installed from https://www.github.com/nvidia/apex . 2020-03-11 17:10:55,473 - INFO - pytorch_transformers.modeling_bert - Better speed can be achieved with apex installed from https://www.github.com/nvidia/apex . 2020-03-11 17:10:55,476 - INFO - pytorch_transformers.modeling_xlnet - Better speed can be achieved with apex installed from https://www.github.com/nvidia/apex . 2020-03-11 17:10:55,637 - INFO - allennlp.common.registrable - instantiating registered subclass relu of <class 'allennlp.nn.activations.Activation'> 2020-03-11 17:10:55,638 - INFO - allennlp.common.registrable - instantiating registered subclass relu of <class 'allennlp.nn.activations.Activation'> 2020-03-11 17:10:55,638 - INFO - allennlp.common.registrable - instantiating registered subclass relu of <class 'allennlp.nn.activations.Activation'> 2020-03-11 17:10:55,639 - INFO - allennlp.common.registrable - instantiating registered subclass relu of <class 'allennlp.nn.activations.Activation'> Traceback (most recent call last): File "/home/detuvoldo/anaconda3/envs/nmn/bin/allennlp", line 8, in <module> sys.exit(run()) File "/home/detuvoldo/anaconda3/envs/nmn/lib/python3.6/site-packages/allennlp/run.py", line 18, in run main(prog="allennlp") File "/home/detuvoldo/anaconda3/envs/nmn/lib/python3.6/site-packages/allennlp/commands/__init__.py", line 101, in main import_submodules(package_name) File "/home/detuvoldo/anaconda3/envs/nmn/lib/python3.6/site-packages/allennlp/common/util.py", line 323, in import_submodules module = importlib.import_module(package_name) File "/home/detuvoldo/anaconda3/envs/nmn/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "./semqa/__init__.py", line 1, in <module> import semqa.state_machines File "./semqa/state_machines/__init__.py", line 1, in <module> from semqa.state_machines.constrained_beam_search import FirstStepConstrainedBeamSearch File "./semqa/state_machines/constrained_beam_search.py", line 6, in <module> from allennlp_semparse.state_machines.states import State File "./allennlp_semparse/state_machines/__init__.py", line 26, in <module> from allennlp_semparse.state_machines.beam_search import BeamSearch File "./allennlp_semparse/state_machines/beam_search.py", line 9, in <module> from allennlp_semparse.state_machines.states import State File "./allennlp_semparse/state_machines/states/__init__.py", line 14, in <module> from allennlp_semparse.state_machines.states.coverage_state import CoverageState File "./allennlp_semparse/state_machines/states/coverage_state.py", line 7, in <module> from allennlp_semparse.fields.production_rule_field import ProductionRule File "./allennlp_semparse/fields/__init__.py", line 1, in <module> from allennlp_semparse.fields.knowledge_graph_field import KnowledgeGraphField File "./allennlp_semparse/fields/knowledge_graph_field.py", line 14, in <module> from allennlp.data.tokenizers import Token, Tokenizer, SpacyTokenizer ImportError: cannot import name 'SpacyTokenizer'
It seems that the error comes from allennlp_semparse. I clone it from the provided link. How can I fix it?
@detuvoldo how did you solve it ?
@unbreading I just need to run the following line:
git checkout 937d594