title: Custom NERs training with spaCy 3 throws ValueError
body: <p>I am trying to add custom NER labels using spacy 3. I found tutorials for older versions and made adjustments for spacy 3. Here is the whole code I am using:</p>
  <pre><code>import random
  import spacy
  from spacy.training import Example
  
  LABEL = 'ANIMAL'
  TRAIN_DATA = [
      (&quot;Horses are too tall and they pretend to care about your feelings&quot;, {'entities': [(0, 6, LABEL)]}),
      (&quot;Do they bite?&quot;, {'entities': []}),
      (&quot;horses are too tall and they pretend to care about your feelings&quot;, {'entities': [(0, 6, LABEL)]}),
      (&quot;horses pretend to care about your feelings&quot;, {'entities': [(0, 6, LABEL)]}),
      (&quot;they pretend to care about your feelings, those horses&quot;, {'entities': [(48, 54, LABEL)]}),
      (&quot;horses?&quot;, {'entities': [(0, 6, LABEL)]})
  ]
  nlp = spacy.load('en_core_web_sm')  # load existing spaCy model
  ner = nlp.get_pipe('ner')
  ner.add_label(LABEL)
  print(ner.move_names) # Here I see, that the new label was added
  optimizer = nlp.create_optimizer()
  # get names of other pipes to disable them during training
  other_pipes = [pipe for pipe in nlp.pipe_names if pipe != &quot;ner&quot;]
  with nlp.disable_pipes(*other_pipes):  # only train NER
      for itn in range(20):
          random.shuffle(TRAIN_DATA)
          losses = {}
          for text, annotations in TRAIN_DATA:
              doc = nlp(text)
              example = Example.from_dict(doc, annotations)
              nlp.update([example], drop=0.35, sgd=optimizer, losses=losses)
          print(losses)
  # test the trained model # add some dummy sentences with many NERs
  
  test_text = 'Do you like horses?'
  doc = nlp(test_text)
  print(&quot;Entities in '%s'&quot; % test_text)
  for ent in doc.ents:
      print(ent.label_, &quot; -- &quot;, ent.text)
  </code></pre>
  <p>This code outputs the ValueError exception, but only after 2 iterations - notice the first 2 lines:</p>
  <pre><code>{'ner': 9.862242701536594}
  {'ner': 8.169456698315201}
  Traceback (most recent call last):
    File &quot;.\custom_ner_training.py&quot;, line 46, in &lt;module&gt;
      nlp.update([example], drop=0.35, sgd=optimizer, losses=losses)
    File &quot;C:\ogr\moje\python\spacy_pg\myvenv\lib\site-packages\spacy\language.py&quot;, line 1106, in update
      proc.update(examples, sgd=None, losses=losses, **component_cfg[name])
    File &quot;spacy\pipeline\transition_parser.pyx&quot;, line 366, in spacy.pipeline.transition_parser.Parser.update
    File &quot;spacy\pipeline\transition_parser.pyx&quot;, line 478, in spacy.pipeline.transition_parser.Parser.get_batch_loss
    File &quot;spacy\pipeline\_parser_internals\ner.pyx&quot;, line 310, in spacy.pipeline._parser_internals.ner.BiluoPushDown.set_costs
  ValueError
  </code></pre>
  <p>I see the <code>ANIMAL</code> label was added by calling <code>ner.move_names</code>.</p>
  <p>When I change my the value <code>LABEL = 'PERSON</code>, the code runs successfully and recognizes horses as <code>PERSON</code> on the new data. This is why I am assuming, there is no error in the code itself.</p>
  <p>Is there something I am missing? What am I doing wrong? Could someone reproduce, please?</p>
  <p>NOTE: This is my first question ever here. I hope I provided all information. If not, let me know in the comments.</p>