Rasa: Spacy 2.0

Created on 30 Jun 2017  Â·  24Comments  Â·  Source: RasaHQ/rasa

I'm wondering if it's possible to work with SpaCy 2.0.

I can change the dev-requirements and force it to version 2.0
However, I not sure about the impacts. Anyone have look it?

type

Most helpful comment

@Moumouls sounds great - keep me posted :+1:

All 24 comments

I don't know of anyone who has tried it. If you do let us know how it goes, but I was under the impression that 2.0 was a big breaking change though.

Is there a specific need driving the desire for 2.0 or just curiosity?

since we aren't doing any model training with spacy at the moment I guess there shouldn't be a big issue there (you should avoid using and training models with different spacy versions though, so just keep them consistent). but tbh I haven't tried it for a couple of weeks because it was still very unstable when I touched it.

Has anyone tried this (rasa + spaCy 2.0)?

not that I know of

I tried and get some errors, @wrathagom have you got plans to support spacy 2?

@vctrferreira what error did you get?

First visible error is when instantiated spacy, in file spacy_utils.py line 109
if nlp.path is None:
nlp object has no attribute path, I solved this problem removing this block
Second error is when I parse new interpretations, new interpretations returns first interpretation every time

@tmbo
I tried with English model and Portuguese, that last one I have build from scratch, both give me the same error, like @vctrferreira said.

INFO:rasa_nlu.utils.spacy_utils:Trying to load spacy model with name 'en'
Traceback (most recent call last):
  File "/root/anaconda3/envs/spacy2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/root/anaconda3/envs/spacy2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/renato/Arquivos/rasa/rasa_nlu/train.py", line 96, in <module>
    do_train(config)
  File "/home/renato/Arquivos/rasa/rasa_nlu/train.py", line 83, in do_train
    trainer = Trainer(config, component_builder)
  File "rasa_nlu/model.py", line 124, in __init__
    component = component_builder.create_component(component_name, config)
  File "rasa_nlu/components.py", line 327, in create_component
    component = registry.create_component_by_name(component_name, config)
  File "rasa_nlu/registry.py", line 136, in create_component_by_name
    return component_clz.create(config)
  File "rasa_nlu/utils/spacy_utils.py", line 53, in create
    cls.ensure_proper_language_model(nlp)
  File "rasa_nlu/utils/spacy_utils.py", line 109, in ensure_proper_language_model
    if nlp.path is None:
AttributeError: 'English' object has no attribute 'path'

spacy 2.0 is still not stable - but as soon as there is a stable release or a release candidate we will quickly add it. (which doesn't say that you can not provide a PR to provide support for the alpha version in the meantime 😉 )

We're getting closer to a RC, although there's still a bit to do. The policy re breaking changes has been to keep the Doc, Token and Span API pretty much the same compared to the 1.x branch. There have been changes to training, vectors, saving and loading, and the NLP pipeline.

At the moment we're breaking model compatibility very often with the nightlies, so you'll have to redownload (and retrain models) a lot. On the plus side, accuracy is improving pretty quickly. The NER model is now at 86.5% F1 on OntoNotes 5, a 30% error reduction over spaCy 1. The current model is rather slow on CPU, but I've got a branch that's hitting a better speed/accuracy trade-off.

More details here: https://alpha.spacy.io/usage/

@honnibal sounds great, I am excited for the changes 2.0 brings. I'll keep an eye out for the RC.

First of all, thanks for the great product!
Second, Spacy 2.0 is out there https://spacy.io/usage/v2.
Do you have plans to integrate it anytime soon?

just tried it and it seems to work out of the box â„¢. Nevertheless, there are a couple of cool features we can add with that new versions. did you run into any issues @shasha79

Hi @tmbo with our team we are going to test it (v2) in our dev environment ! I'll keep you informed !

@Moumouls sounds great - keep me posted :+1:

Are there any plans to accommodate training spacy (2.0) ner/intent models? (As opposed to only allowing for built-in spacy models)

Hi ! I have good news after few tests on our dev environement, it seems that Spacy 2.0.2 is fully compatible with the last version of Rasa 10.4.
I have tested training a small model with FR language and to use it : it works (with the http server).

I have just to reported one thing, training time seems to be a little bit longer.

So you have all the advantages of Spacy v2 ready to run !

@tmbo

Sounds great!

@roryjbeard definitely.

@Moumouls concerning the project suggestion, can you create a separate issue for that so we don't forget about it?

@tmbo no problem for the project suggestion !

I just re-check @tmbo, the project creation on the fly works ! So it's fully flexible.

:tada:

It's true that training is slower. There are also tonnes more hyper-parameters, unfortunately. The docs are much better though: https://spacy.io/usage/training

I have some doubts about the add-a-label functionality when using a pre-trained model, so you should test that carefully.

any news about compatibility with spacy 2.0?
I've tried to install spacy 2.0.5 . Then latest rasa-nlu. Running:
python -m rasa_nlu.train -c sample_configs/config_spacy.json

It cannot find the language module en because it trys to load lang from the root of spacy (1.x structure).

Speaking without testing this, but you may need to do something like

python -m spacy download en_core_web_sm
python -m spacy link en_core_web_sm en

to first download the spacy 2.0 model and then link it to the name Rasa is expecting.

supported in latest release 0.11.x

Was this page helpful?
0 / 5 - 0 ratings