I tried to get the ner.openai recipes working on OSX (Silicon) and Linux (Intel), with Prodigy 1.12.0 using Python 3.9, 3.10,3.11. I tried the examples from the documentation page. However, I always get errors, see below for a trace.
./run.sh prodigy ner.openai.correct recipe-ner examples.jsonl --label dish,ingredient,equipment
Using 3 labels from model: dish, ingredient, equipment
Traceback (most recent call last):
File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.9/site-packages/prodigy/__main__.py", line 63, in <module>
controller = recipe(*args, use_plac=True)
File "cython_src/prodigy/core.pyx", line 868, in prodigy.core.recipe.recipe_decorator.recipe_proxy
File "cython_src/prodigy/core.pyx", line 153, in prodigy.core.Controller.from_components
File "cython_src/prodigy/core.pyx", line 297, in prodigy.core.Controller.__init__
File "cython_src/prodigy/components/stream.pyx", line 178, in prodigy.components.stream.Stream.is_empty
File "cython_src/prodigy/components/stream.pyx", line 193, in prodigy.components.stream.Stream.peek
File "cython_src/prodigy/components/stream.pyx", line 326, in prodigy.components.stream.Stream._get_from_iterator
File "/usr/local/lib/python3.9/site-packages/prodigy/recipes/openai/ner.py", line 235, in to_stream
for ex in openai(stream, batch_size=batch_size, nlp=nlp):
File "cython_src/prodigy/components/openai.pyx", line 242, in set_hashes
File "cython_src/prodigy/components/openai.pyx", line 289, in format_suggestions
File "cython_src/prodigy/components/preprocess.pyx", line 172, in add_tokens
File "/usr/local/lib/python3.9/site-packages/spacy/language.py", line 1538, in pipe
for doc in docs:
File "/usr/local/lib/python3.9/site-packages/spacy/language.py", line 1582, in pipe
for doc in docs:
File "/usr/local/lib/python3.9/site-packages/spacy/language.py", line 1579, in <genexpr>
docs = (self._ensure_doc(text) for text in texts)
File "/usr/local/lib/python3.9/site-packages/spacy/language.py", line 1528, in <genexpr>
docs_with_contexts = (
File "cython_src/prodigy/components/preprocess.pyx", line 165, in genexpr
File "cython_src/prodigy/components/openai.pyx", line 268, in stream_suggestions
File "cython_src/prodigy/components/openai.pyx", line 695, in batch_sequence
File "cython_src/prodigy/components/loaders.pyx", line 47, in _add_attrs
File "cython_src/prodigy/components/filters.pyx", line 50, in filter_duplicates
File "cython_src/prodigy/components/filters.pyx", line 21, in filter_empty
File "cython_src/prodigy/components/loaders.pyx", line 41, in _rehash_stream
File "cython_src/prodigy/components/source.pyx", line 693, in load_noop
File "cython_src/prodigy/components/source.pyx", line 107, in __iter__
File "cython_src/prodigy/components/source.pyx", line 108, in prodigy.components.source.Source.__iter__
File "cython_src/prodigy/components/source.pyx", line 578, in read
File "/usr/local/lib/python3.9/site-packages/srsly/_json_api.py", line 39, in json_loads
return ujson.loads(data)
ValueError: Expected object or value
The OpenAI keys seem to be ok. Any idea?