# training long sequence on spancat memory problem

**URL:** <https://support.prodi.gy/t/training-long-sequence-on-spancat-memory-problem/6462>\
**Category:** Uncategorized\
**Tags:** spancat\
**Created:** [March 29, 2023, 5:37pm UTC](https://support.prodi.gy/t/training-long-sequence-on-spancat-memory-problem/6462 "2023-03-29T17:37:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [March 29, 2023, 6:12pm UTC](https://support.prodi.gy/t/training-long-sequence-on-spancat-memory-problem/6462/2 "2023-03-29T18:12:02Z")

</div>

Hi @kushal_pythonist,

Have you seen this post?

> [@spancat out of memory](https://support.prodi.gy/t/spancat-out-of-memory/5459/2):
>
> It's possible that this is related to the suggester function, which by default, will use an ngram range of all the available spans lengths in the data. So if you have really long spans, you'll end up with a lot of potential candidates (e.g. all possible spans between 1 and 60 tokens, which can be a lot). If you run prodigy train with the --verbose flag, it should show you more detailed information on the suggester function used: [https://prodi.gy/docs/span-categorization#suggesters](https://prodi.gy/docs/span-categorization#suggesters) One option t…

You should consider modifying your suggested function.

Have you tried to identify any outlier text inputs? For example, try to train on half of your data. If it still doesn't train, then try on first 10%, etc. You may be able to find a few records that drive this.

If you run `data-to-spacy --spancat your_dataset` then run [`data debug`](https://spacy.io/api/cli#debug-data), you can get some stats on your span characteristics.

> If your pipeline contains a `spancat` component, then this command will also report span characteristics such as the average span length and the span (or span boundary) distinctiveness. The distinctiveness measure shows how different the tokens are with respect to the rest of the corpus using the KL-divergence of the token distributions. To learn more, you can check out Papay et al.’s work on [_Dissecting Span Identification Tasks with Performance Prediction_ (EMNLP 2020)](https://aclanthology.org/2020.emnlp-main.396/).

Since this problem is really a spaCy issue (not Prodigy), you may want to search and/or post on spaCy GitHub discussions for a solution, for example:

> **[What is the maximum length the annotation of a span can be? · explosion/spaCy...](https://github.com/explosion/spaCy/discussions/11450)**
>
> Hi, I am trying to train a span categorizer but since I'm new to it, I am a bit unsure how to annotate my data. I'm using the spancat as a parser to extract specific sections from a document. Somet...

---

_[View the full topic](https://support.prodi.gy/t/training-long-sequence-on-spancat-memory-problem/6462)._
