Python error with pos.teach

Hello, I'm just getting started and am getting an error with pos.teach. I'd appreciate your help in getting this working. Note that pos.make-gold is working so the error is specific to pos.teach.

Here is my command to get started:

PRODIGY_LOGGING=verbose prodigy pos.teach pos_test en_core_web_lg test.jsonl

My data looks like this (I have some metadata for my own purposes):

{"n": "18", "text": "This is my text.", "pn": "1234"}

I get a traceback that ends with:

File "cython_src/prodigy/models/pos.pyx", line 104, in call
TypeError: argument of type 'NoneType' is not iterable

Here is the full traceback:

11:30:05 - FILTER: Filtering out empty examples for key 'text'
11:30:06 - Exception when serving /get_questions
Traceback (most recent call last):
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/waitress/channel.py", line 336, in service
    task.service()
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/waitress/task.py", line 175, in service
    self.execute()
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/waitress/task.py", line 452, in execute
    app_iter = self.channel.server.application(env, start_response)
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/hug/api.py", line 423, in api_auto_instantiate
    return module.__hug_wsgi__(*args, **kwargs)
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/falcon/api.py", line 244, in __call__
    responder(req, resp, **params)
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/hug/interface.py", line 793, in __call__
    raise exception
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/hug/interface.py", line 766, in __call__
    self.render_content(self.call_function(input_parameters), context, request, response, **kwargs)
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/hug/interface.py", line 703, in call_function
    return self.interface(**parameters)
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/hug/interface.py", line 100, in __call__
    return __hug_internal_self._function(*args, **kwargs)
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/prodigy/app.py", line 105, in get_questions
    tasks = controller.get_questions()
  File "cython_src/prodigy/core.pyx", line 109, in prodigy.core.Controller.get_questions
  File "cython_src/prodigy/components/feeds.pyx", line 56, in prodigy.components.feeds.SharedFeed.get_questions
  File "cython_src/prodigy/components/feeds.pyx", line 61, in prodigy.components.feeds.SharedFeed.get_next_batch
  File "cython_src/prodigy/components/feeds.pyx", line 130, in prodigy.components.feeds.SessionFeed.get_session_stream
  File "/Users/joneill/.virtualenvs/claim-parser/lib/python3.6/site-packages/toolz/itertoolz.py", line 368, in first
    return next(iter(seq))
  File "cython_src/prodigy/components/sorters.pyx", line 107, in __iter__
  File "cython_src/prodigy/components/sorters.pyx", line 51, in genexpr
  File "cython_src/prodigy/models/pos.pyx", line 104, in __call__
TypeError: argument of type 'NoneType' is not iterable

Some more info that may be helpful… If I specify some labels like this:

PRODIGY_LOGGING=verbose prodigy pos.teach pos_test en_core_web_lg test.jsonl -U -l NOUN,VERB

then it works initially, and I can do some annotation but it fails later on.

If it fails later on, does it show the same error?

Error above happened because no labels were specified – Prodigy should definitely fail more gracefully here or just default to all labels if none are specified. Will fix this, thanks!

Thanks for the reply. Would be great to fix the documentation:

Label(s) to annotate. Accepts single label or comma-separated list. If not set, all available labels will be returned.

I don't have the error for the other situation but will repost if it happens again.

1 Like