Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using spacy CLI train command #1008

Closed
xiapoy opened this issue Apr 23, 2017 · 9 comments
Closed

Error when using spacy CLI train command #1008

xiapoy opened this issue Apr 23, 2017 · 9 comments
Labels
bug Bugs and behaviour differing from documentation

Comments

@xiapoy
Copy link

xiapoy commented Apr 23, 2017

I tried to train a tagger and parser using the spacy CLI train command:

python -m spacy train <lang> . <lang>-train.json --no-ner

The script breaks at the end of the training; here is the output:

Itn.	N weight	N feats	UAS	NER F.	Tag %	Token %
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1455/1455 [01:11<00:00, 20.37it/s]
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/ubuntu/spaCy/spacy/__main__.py", line 133, in <module>
    plac.Interpreter.call(CLI)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 1142, in call
    print(out)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 914, in __exit__
    self.close(exctype, exc, tb)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 952, in close
    self._interpreter.throw(exctype, exc, tb)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 964, in _make_interpreter
    arglist = yield task
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 1139, in call
    raise_(task.etype, task.exc, task.tb)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 380, in _wrap
    for value in genobj:
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 95, in gen_exc
    raise_(etype, exc, tb)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 966, in _make_interpreter
    cmd, result = self.parser.consume(arglist)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_core.py", line 207, in consume
    return cmd, self.func(*(args + varargs + extraopts), **kwargs)
  File "/home/ubuntu/spaCy/spacy/__main__.py", line 95, in train
    not no_parser, not no_ner, parser_L1)
  File "/home/ubuntu/spaCy/spacy/cli/train.py", line 39, in train
    entity_cfg, n_iter)
  File "/home/ubuntu/spaCy/spacy/cli/train.py", line 68, in train_model
    **dev_scores.scores)
AttributeError: 'list' object has no attribute 'scores'

My current environment is:

    Info about spaCy

    Python version     2.7.12         
    Platform           Linux-4.4.0 Ubuntu-16.04
    spaCy version      1.8.0          
    Installed models                   
    Location           /home/ubuntu/spaCy/spacy
@ines ines added the bug Bugs and behaviour differing from documentation label Apr 23, 2017
@ines
Copy link
Member

ines commented Apr 23, 2017

Thanks for the report – fixing!

(Looks like the main problem here is the dev scores not being passed to print_progress correctly when using the command without dev_data. So yeah, it failed on... printing 😉 Sorry about that.)

@ines ines closed this as completed in 3a9710f Apr 23, 2017
@xiapoy
Copy link
Author

xiapoy commented Apr 23, 2017

Thanks for your quick answer. I re-compiled spaCy from source and tried to re-train the models, but got a new error. Here is the output:

Itn.	N weight	N feats	UAS	NER F.	Tag %	Token %
100%|██████████████████████████████████████████████████████████████████████| 1455/1455 [01:09<00:00, 23.41it/s]
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/ubuntu/spaCy/spacy/__main__.py", line 133, in <module>
    plac.Interpreter.call(CLI)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 1142, in call
    print(out)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 914, in __exit__
    self.close(exctype, exc, tb)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 952, in close
    self._interpreter.throw(exctype, exc, tb)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 964, in _make_interpreter
    arglist = yield task
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 1139, in call
    raise_(task.etype, task.exc, task.tb)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 380, in _wrap
    for value in genobj:
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 95, in gen_exc
    raise_(etype, exc, tb)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_ext.py", line 966, in _make_interpreter
    cmd, result = self.parser.consume(arglist)
  File "/home/ubuntu/spaCy/.env/local/lib/python2.7/site-packages/plac_core.py", line 207, in consume
    return cmd, self.func(*(args + varargs + extraopts), **kwargs)
  File "/home/ubuntu/spaCy/spacy/__main__.py", line 95, in train
    not no_parser, not no_ner, parser_L1)
  File "/home/ubuntu/spaCy/spacy/cli/train.py", line 39, in train
    entity_cfg, n_iter)
  File "/home/ubuntu/spaCy/spacy/cli/train.py", line 68, in train_model
    **dev_scores)
  File "/home/ubuntu/spaCy/spacy/cli/train.py", line 101, in print_progress
    print(tpl.format(itn, nr_weight, nr_active_feat, **scores))
KeyError: u'uas'

I am using the same environment. Did I miss something?

@ines ines reopened this Apr 23, 2017
@honnibal
Copy link
Member

Sorry this was my fault. Try again? Just made another tweak.

@xiapoy
Copy link
Author

xiapoy commented Apr 24, 2017

@honnibal I tried again with the last spaCy version (1.8.1) and got the same error.

@ines
Copy link
Member

ines commented Apr 25, 2017

@naileakim Sorry, I think we didn't v1.8.1 still contains the same error (didn't test properly), but it should be fixed on master.

@xiapoy
Copy link
Author

xiapoy commented Apr 26, 2017

I confirm you that I still got that error while using latest master updates. I could finally succeed to train the model by adding the dev_data.

@ines ines reopened this Apr 27, 2017
@ines
Copy link
Member

ines commented Jun 5, 2017

This is finally fixed in v2.0.0 alpha!

@ines ines closed this as completed Jun 5, 2017
@ctthang
Copy link

ctthang commented Jul 31, 2017

how about 1.9.0, @ines ?

@lock
Copy link

lock bot commented May 8, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs and behaviour differing from documentation
Projects
None yet
Development

No branches or pull requests

4 participants