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

Spacy pipeline component #55

Closed
mfdeux opened this issue Jun 19, 2018 · 2 comments
Closed

Spacy pipeline component #55

mfdeux opened this issue Jun 19, 2018 · 2 comments

Comments

@mfdeux
Copy link

mfdeux commented Jun 19, 2018

Is there a reason why the suggested way to load neuralcoref is through the spacy load method ("nlp = spacy.load('en_coref_md')") instead of through, what appears to be the recommended api for adding extensions as pipeline methods? https://spacy.io/usage/processing-pipelines. I see that neuralcoref is loaded this way in the cli. Doesn't the spacy load method place restrictions on how the neuralcoref library can be used with other vocab/vectors?

def load(**overrides):
    disable = overrides.get('disable', [])
    overrides['disable'] = disable + ['neuralcoref']
    nlp = load_model_from_init_py(__file__, **overrides)
    coref = NeuralCoref(nlp.vocab)
    coref.from_disk(nlp.path / 'neuralcoref')
    nlp.add_pipe(coref, name='neuralcoref')
    return nlp
""".strip()
@thomwolf
Copy link
Member

Well you can also do this method but here is the story:
The spaCy's instructions are nice for pipelines extensions without training weights. In our case however, it means you have to first download the weights and the extensions (that was the process in the previous versions of NeuralCoref but it's was bit cumbersome for the user) and then you have to load the coref extension and then populates it's weights before adding it to the pipe.

The instructions I give are the simplest to use if you don't need to re-train the model.

If you need to re-train the model you should install neuralcoref from sources and use the spaCy's instructions after it has been trained indeed.

@mfdeux
Copy link
Author

mfdeux commented Jun 19, 2018

Got it, thanks!

@mfdeux mfdeux closed this as completed Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants