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

Trained NER models are not loadable #999

Closed
YanhaoYang opened this issue Apr 20, 2017 · 3 comments
Closed

Trained NER models are not loadable #999

YanhaoYang opened this issue Apr 20, 2017 · 3 comments
Labels
bug Bugs and behaviour differing from documentation

Comments

@YanhaoYang
Copy link

I use some trained NER models to recognise entity names in some specific domains. After upgrading to v1.8.0, I found those models could not be loaded.

It is easy to reproduce the problem by add following code to the official example, https://github.com/explosion/spaCy/blob/master/examples/training/train_ner.py#L87:

    model_path = Path('./ner')
    ner2 = EntityRecognizer.load(model_path, nlp.vocab)
    doc = nlp.make_doc('Who is Shaka Khan?')
    nlp.tagger(doc)
    ner2(doc)
    for word in doc:
        print(word.text, word.orth, word.lower, word.tag_, word.ent_type_, word.ent_iob)

This will result in following error message:

Traceback (most recent call last):
  File "train_ner.py", line 104, in <module>
    main('ner')
  File "train_ner.py", line 94, in main
    ner2 = EntityRecognizer.load(model_path, nlp.vocab)
  File "spacy/syntax/parser.pyx", line 149, in spacy.syntax.parser.Parser.load (spacy/syntax/parser.cpp:6845)
KeyError: 'actions'

It seems ner.cfg["actions"] is not necessary for NER training, but the loading code will read it anyway.

Info about spaCy

  • spaCy version: 1.8.0
  • Platform: Linux-4.10.0-19-generic-x86_64-with-debian-8.7
  • Python version: 3.6.1
  • Installed models: en
@honnibal honnibal added the bug Bugs and behaviour differing from documentation label Apr 23, 2017
honnibal added a commit that referenced this issue Apr 23, 2017
honnibal added a commit that referenced this issue Apr 23, 2017
@ines
Copy link
Member

ines commented May 7, 2017

Closing this and making #1046 the master issue. Work in progress for spaCy v2.0!

@ines ines closed this as completed May 7, 2017
@lukewendling
Copy link

Anyone found a workaround to load trained NER models in spacy <2.0 ?

@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