# Maximum recursion depth exceeded when using DataCollator

**URL:** <https://discuss.huggingface.co/t/maximum-recursion-depth-exceeded-when-using-datacollator/25937>\
**Category:** 🤗Tokenizers\
**Created:** [November 11, 2022, 3:30pm UTC](https://discuss.huggingface.co/t/maximum-recursion-depth-exceeded-when-using-datacollator/25937 "2022-11-11T15:30:57Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![clawdelu](https://avatars.discourse-cdn.com/v4/letter/c/97f17d/32.png) [@clawdelu](https://discuss.huggingface.co/u/clawdelu)\
**Post date:** [November 14, 2022, 9:19am UTC](https://discuss.huggingface.co/t/maximum-recursion-depth-exceeded-when-using-datacollator/25937/2 "2022-11-14T09:19:30Z")

</div>

After some more digging I’ve discovered that the issue is related to [this one](https://discuss.huggingface.co/t/issues-with-data-collator-and-tokenizing-with-ner-datasets/17489).

The padding strategies are [‘longest’, ‘max\_length’, ‘do\_not\_pad’]. The issue seems to be improper padding. If you set the strategy to `do_not_pad` it will work (for one sentence) ` tokenizer(example)`.

But even when I set the max\_length of the tokenizer to a number, the issue still persists.

---

_[View the full topic](https://discuss.huggingface.co/t/maximum-recursion-depth-exceeded-when-using-datacollator/25937)._
