# \`ValueError\` when initiating \`ner.teach\`.

**URL:** <https://support.prodi.gy/t/valueerror-when-initiating-ner-teach/1038>\
**Category:** Uncategorized\
**Tags:** solved, usage\
**Created:** [December 12, 2018, 8:56pm UTC](https://support.prodi.gy/t/valueerror-when-initiating-ner-teach/1038 "2018-12-12T20:56:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nix411](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/nix411/32/2982_2.png) [@nix411](https://support.prodi.gy/u/nix411)\
**Post date:** [December 12, 2018, 8:56pm UTC](https://support.prodi.gy/t/valueerror-when-initiating-ner-teach/1038/1 "2018-12-12T20:56:54Z")

</div>

I run the following

```
prodigy dataset ner_money "Improve MONEY on Earnings data"
prodigy ner.teach ner_money en_core_web_sm earnings_lines.jsonl --label MONEY

```

but then I receive the following traceback

```
Traceback (most recent call last):
  File "/home/bjerre/Projects/plx/fact-extractor/venv/lib/python3.6/site-packages/waitress/channel.py", line 338, in service
    task.service()
  File "/home/bjerre/Projects/plx/fact-extractor/venv/lib/python3.6/site-packages/waitress/task.py", line 169, in service
    self.execute()
  File "/home/bjerre/Projects/plx/fact-extractor/venv/lib/python3.6/site-packages/waitress/task.py", line 399, in execute
    app_iter = self.channel.server.application(env, start_response)
  File "/home/bjerre/Projects/plx/fact-extractor/venv/lib/python3.6/site-packages/hug/api.py", line 423, in api_auto_instantiate
    return module. __hug_wsgi__ (*args, **kwargs)
  File "/home/bjerre/Projects/plx/fact-extractor/venv/lib/python3.6/site-packages/falcon/api.py", line 244, in __call__
    responder(req, resp, **params)
  File "/home/bjerre/Projects/plx/fact-extractor/venv/lib/python3.6/site-packages/hug/interface.py", line 793, in __call__
    raise exception
  File "/home/bjerre/Projects/plx/fact-extractor/venv/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 "/home/bjerre/Projects/plx/fact-extractor/venv/lib/python3.6/site-packages/hug/interface.py", line 703, in call_function
    return self.interface(**parameters)
  File "/home/bjerre/Projects/plx/fact-extractor/venv/lib/python3.6/site-packages/hug/interface.py", line 100, in __call__
    return __hug_internal_self._function(*args, **kwargs)
  File "/home/bjerre/Projects/plx/fact-extractor/venv/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 "/home/bjerre/Projects/plx/fact-extractor/venv/lib/python3.6/site-packages/toolz/itertoolz.py", line 368, in first
    return next(iter(seq))
  File "cython_src/prodigy/components/sorters.pyx", line 136, in __iter__
  File "cython_src/prodigy/components/sorters.pyx", line 51, in genexpr
  File "cython_src/prodigy/models/ner.pyx", line 273, in __call__
  File "cython_src/prodigy/models/ner.pyx", line 256, in get_tasks
ValueError: dictionary update sequence element #0 has length 1; 2 is required

```

Attached: [earnings\_lines.jsonl](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/1X/c5a7ae5c2555633cd81c312be4a66d60a82c1e20.jsonl) (1.3 KB)

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [December 12, 2018, 9:35pm UTC](https://support.prodi.gy/t/valueerror-when-initiating-ner-teach/1038/2 "2018-12-12T21:35:53Z")

</div>

Thanks for sharing the report and your data – Prodigy should have definitely handled this better.

The problem here is that when the NER model updates the `"meta"` with the score, it expects it to be a dictionary. However, in your data, the `"meta"` is a string. So changing your records to something like this should work:

```json
{"text": "...", "meta": {"something": "cision:20150716:BIT:4665:0"}}

```

---

<div class="post-metadata">

**Author:** ![nix411](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/nix411/32/2982_2.png) [@nix411](https://support.prodi.gy/u/nix411)\
**Post date:** [December 12, 2018, 10:01pm UTC](https://support.prodi.gy/t/valueerror-when-initiating-ner-teach/1038/3 "2018-12-12T22:01:34Z")

</div>

Ah yes of course.

It works now. I am a bit puzzled that it seems it presents the examples ordered by the lines in `earnings_lines.jsonl` instead of giving me the 50/50 examples. Can that be right?

---

<div class="post-metadata">

**Author:** ![nix411](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/nix411/32/2982_2.png) [@nix411](https://support.prodi.gy/u/nix411)\
**Post date:** [December 12, 2018, 10:22pm UTC](https://support.prodi.gy/t/valueerror-when-initiating-ner-teach/1038/4 "2018-12-12T22:22:41Z")

</div>

KUDOS to explosion.ai ! I am truly amazed by the results for minimal effort

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [December 12, 2018, 11:43pm UTC](https://support.prodi.gy/t/valueerror-when-initiating-ner-teach/1038/5 "2018-12-12T23:43:02Z")

</div>

Yay, glad it worked!

> [@nix411](#):
>
> I am a bit puzzled that it seems it presents the examples ordered by the lines in `earnings_lines.jsonl` instead of giving me the 50/50 examples. Can that be right?

What does the "score" (displayed in the meta in the corner) look like? Depending on what's in the data, it might take a batch or two for the exponential moving average to calibrate.

Btw, looking at your data, you might want to try stripping out the `" * "` in your preprocessing (since you're preprocessing anyways). Those could potentially throw off the model, since it's likely never seen texts like that before. But without the bullet points, you have pretty normal sentences there that you could probably also get very decent dependency parsing and POS tagging accuracy on.

---

<div class="post-metadata">

**Author:** ![nix411](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/nix411/32/2982_2.png) [@nix411](https://support.prodi.gy/u/nix411)\
**Post date:** [December 13, 2018, 8:06am UTC](https://support.prodi.gy/t/valueerror-when-initiating-ner-teach/1038/6 "2018-12-13T08:06:38Z")

</div>

The score were pretty uniformly distributed and not centered around 0.5. Nevertheless I still got good results but I will keep an eye out for this. This was just meant as an initial test.

I actually intended to include the markdown tags. My theory being that the model might be able to pick up on those. The facts I want to extract are often found in lists like that (but not always).

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [December 13, 2018, 6:19pm UTC](https://support.prodi.gy/t/valueerror-when-initiating-ner-teach/1038/7 "2018-12-13T18:19:56Z")

</div>

> [@nix411](#):
>
> I actually intended to include the markdown tags. My theory being that the model might be able to pick up on those. The facts I want to extract are often found in lists like that (but not always).

Ah okay, fair enough! I'd definitely be interested in the results if you end up running experiments with and without the Markdown. This is also a nice example of the type of stuff we're hoping that Prodigy can help with – do a few hundred examples with Markdown, a few hundred without and compare the results 🙂

---

<div class="post-metadata">

**Author:** ![nix411](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/nix411/32/2982_2.png) [@nix411](https://support.prodi.gy/u/nix411)\
**Post date:** [December 13, 2018, 8:46pm UTC](https://support.prodi.gy/t/valueerror-when-initiating-ner-teach/1038/8 "2018-12-13T20:46:43Z")

</div>

I will let you know. I have a 3 weeks vacation coming up so it will be on the other side though.
