# SPANCAT not training on single label

**URL:** <https://support.prodi.gy/t/spancat-not-training-on-single-label/4649>\
**Category:** Uncategorized\
**Tags:** spacy, spancat\
**Created:** [September 4, 2021, 3:14am UTC](https://support.prodi.gy/t/spancat-not-training-on-single-label/4649 "2021-09-04T03:14:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Onyoursix](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/onyoursix/32/1579_2.png) [@Onyoursix](https://support.prodi.gy/u/Onyoursix)\
**Post date:** [September 4, 2021, 3:14am UTC](https://support.prodi.gy/t/spancat-not-training-on-single-label/4649/1 "2021-09-04T03:14:05Z")

</div>

I'm not entirely sure if this would be a Spacy issue or a Prodigy issue.

I've been testing out accuracy between NER and SPANCAT with a few labels to see which one gives me better results. The first data set I had two labels which I labeled together using Prodigy (both NER and SPANCAT). The next label I did just by itself in a new data set. NER I got roughly 77% but with SPANCAT I get 0%, I was super puzzled by this and thought maybe I didn't have enough examples, it's a super easy label with patterns so I got up to 2,000 examples fairly quickly and I still am getting 0% on the precision, recall, & f scores.

Just to be clear, each data set I've created twice, one as a NER and another as a SPANCAT.

I merged the two SPANCAT data sets together (first one with two labels, second one with one label) and tried to train again, that one I also got 0% across the board as well (before the one with two labels worked fine). Any idea what might be going on here? I also exported datasets to Spacy and had the same results.

Here's output from the training with one label.

 ![Screenshot from 2021-09-03 21-13-11](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/7/7910db44358f3c3dad54dc622caf14c2456f63c2.png)

---

<div class="post-metadata">

**Author:** ![lnatprodigy](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@lnatprodigy](https://support.prodi.gy/u/lnatprodigy)\
**Post date:** [September 4, 2021, 7:31am UTC](https://support.prodi.gy/t/spancat-not-training-on-single-label/4649/2 "2021-09-04T07:31:26Z")

</div>

Are you on the very latest version of spacy?  
There was a bug in the initial release of the spancat component, that lead to exactly this experience (I was running into this exact thing myself).

---

<div class="post-metadata">

**Author:** ![Onyoursix](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/onyoursix/32/1579_2.png) [@Onyoursix](https://support.prodi.gy/u/Onyoursix)\
**Post date:** [September 4, 2021, 5:56pm UTC](https://support.prodi.gy/t/spancat-not-training-on-single-label/4649/3 "2021-09-04T17:56:03Z")

</div>

I am, I'm on spacy version 3.1.2, I believe I came across the posts regarding the issue you're referring to and it was suggested as a temporary fix to edit the `spancat.py` file. I opened the file and it seems the bug referenced in the threads was indeed applied already.

I believe I may have found the culprit though. When I train with `--base-model blank:en` I get a score of 0's like the screen shot above. However, if I change the `--base-model` to say `en_core_web_sm` I am now getting scores.

 ![Screenshot from 2021-09-04 11-55-04](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/7/734886a2c86d23e947a1a7e63904f697a6ad7c46.png)

---

<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:** [September 7, 2021, 1:14am UTC](https://support.prodi.gy/t/spancat-not-training-on-single-label/4649/4 "2021-09-07T01:14:35Z")

</div>

> [@Onyoursix](#):
>
> I believe I may have found the culprit though. When I train with `--base-model blank:en` I get a score of 0's like the screen shot above. However, if I change the `--base-model` to say `en_core_web_sm` I am now getting scores.

That's strange 🤔 If you look at the configs generated in both scenarios, are there any differences related to the `spancat` component?

---

<div class="post-metadata">

**Author:** ![Onyoursix](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/onyoursix/32/1579_2.png) [@Onyoursix](https://support.prodi.gy/u/Onyoursix)\
**Post date:** [September 7, 2021, 2:15am UTC](https://support.prodi.gy/t/spancat-not-training-on-single-label/4649/5 "2021-09-07T02:15:27Z")

</div>

I checked all 3 config files (2 for the data sets, 1 for both of them combined). The only difference is the `max_size` which I would assume is correct because of the difference in n\_grams and the combined set had the larger of the two, as well as the labels location was different (of course).

[components.spancat.suggester]  
@misc = "spacy.ngram\_range\_suggester.v1"  
min\_size = 1  
max\_size = 13

[components.spancat.suggester]  
@misc = "spacy.ngram\_range\_suggester.v1"  
min\_size = 1  
max\_size = 20

I'm wondering if I goofed my data set somewhere, somehow, and I'm just not aware of it.

These two data sets are throwaways and I need to relabel them, so maybe I'll just follow up in this thread in a day or two when I've done that.
