Skip to content

ImportError: cannot import name 'SpacyTokenizer' #41

@maykonmichel

Description

@maykonmichel

Hello, I'm trying to follow your excellent medium post, but I'm getting this ImportError: cannot import name 'SpacyTokenizer' error when I run make train

$ make train

Enter model file: experiments/greetings/copynet.json
Enter model directory (default is /tmp/models/copynet): 
Serializing model to /tmp/models/copynet/run_001
Is this correct? [Y/n] Y
2020-01-14 09:07:45,172 - INFO - allennlp.common.registrable - instantiating registered subclass relu of <class 'allennlp.nn.activations.Activation'>
2020-01-14 09:07:45,174 - INFO - allennlp.common.registrable - instantiating registered subclass relu of <class 'allennlp.nn.activations.Activation'>
2020-01-14 09:07:45,175 - INFO - allennlp.common.registrable - instantiating registered subclass relu of <class 'allennlp.nn.activations.Activation'>
2020-01-14 09:07:45,175 - INFO - allennlp.common.registrable - instantiating registered subclass relu of <class 'allennlp.nn.activations.Activation'>
Traceback (most recent call last):
  File "/home/maykon/.local/bin/allennlp", line 11, in <module>
    sys.exit(run())
  File "/home/maykon/.local/lib/python3.6/site-packages/allennlp/run.py", line 18, in run
    main(prog="allennlp")
  File "/home/maykon/.local/lib/python3.6/site-packages/allennlp/commands/__init__.py", line 101, in main
    import_submodules(package_name)
  File "/home/maykon/.local/lib/python3.6/site-packages/allennlp/common/util.py", line 323, in import_submodules
    module = importlib.import_module(package_name)
  File "/usr/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 "/home/maykon/Documents/GitHub/nlp-models/nlpete/data/dataset_readers/__init__.py", line 1, in <module>
    from nlpete.data.dataset_readers.copynet import CopyNetDatasetReader
  File "/home/maykon/Documents/GitHub/nlp-models/nlpete/data/dataset_readers/copynet.py", line 14, in <module>
    from allennlp.data.tokenizers import Token, Tokenizer, SpacyTokenizer
ImportError: cannot import name 'SpacyTokenizer'
✗ Training job `experiments/greetings/copynet.json` failed.
Total time: 0 hours, 0 minutes and 2 seconds elapsed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions