SentenceSegmenter Attribute error using textcat.teach

I just ran into an error using textcat.teach with a custom model trained on a previous round of labeling. I ran

prodigy textcat.teach capture capture-model masdar_sents.json --label CAPTURE

and after about 20 labels got

Exception when serving /give_answers
Traceback (most recent call last):
  File "/Users/ahalterman/anaconda3/lib/python3.6/site-packages/waitress/channel.py", line 338, in service
    task.service()
  File "/Users/ahalterman/anaconda3/lib/python3.6/site-packages/waitress/task.py", line 169, in service
    self.execute()
  File "/Users/ahalterman/anaconda3/lib/python3.6/site-packages/waitress/task.py", line 399, in execute
    app_iter = self.channel.server.application(env, start_response)
  File "hug/api.py", line 420, in hug.api.ModuleSingleton.__call__.api_auto_instantiate (hug/api.c:14291)
  File "/Users/ahalterman/anaconda3/lib/python3.6/site-packages/falcon/api.py", line 227, in __call__
    responder(req, resp, **params)
  File "hug/interface.py", line 659, in hug.interface.HTTP.__call__ (hug/interface.c:19188)
  File "hug/interface.py", line 600, in hug.interface.HTTP.call_function (hug/interface.c:17322)
  File "hug/interface.py", line 99, in hug.interface.Interfaces.__call__ (hug/interface.c:3672)
  File "/Users/ahalterman/anaconda3/lib/python3.6/site-packages/prodigy/app.py", line 66, in give_answers
    controller.receive_answers(answers)
  File "cython_src/prodigy/core.pyx", line 71, in prodigy.core.Controller.receive_answers
  File "cython_src/prodigy/models/textcat.pyx", line 182, in prodigy.models.textcat.TextClassifier.update
  File "cython_src/prodigy/models/textcat.pyx", line 204, in prodigy.models.textcat.TextClassifier._update
AttributeError: 'SentenceSegmenter' object has no attribute 'update'

Let me know if it would be helpful to have the model or text and I can get it to you.

I’m really enjoying Prodigy! I hope the bug reports don’t make it seem like I’m not.

1 Like

Thanks, and definitely keep reporting :slight_smile:

It seems the ._update() method is assuming the textcat model is the last in the pipeline. Seems like an easy bug to fix.

In the meantime, you could work around this by reordering the nlp.pipeline list?