# DataCollator uses Tokenizer while having BatchEncodings?

**URL:** <https://discuss.huggingface.co/t/datacollator-uses-tokenizer-while-having-batchencodings/75350>\
**Category:** 🤗Transformers\
**Created:** [February 29, 2024, 2:29pm UTC](https://discuss.huggingface.co/t/datacollator-uses-tokenizer-while-having-batchencodings/75350 "2024-02-29T14:29:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bengisucam](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/bengisucam/32/21900_2.png) [@bengisucam](https://discuss.huggingface.co/u/bengisucam)\
**Post date:** [February 29, 2024, 2:29pm UTC](https://discuss.huggingface.co/t/datacollator-uses-tokenizer-while-having-batchencodings/75350/1 "2024-02-29T14:29:39Z")

</div>

I did not understand the intuition behind this: The DataCollatorForLanguageModeling expects tokenizer while it forces to operate on tokenized data (BatchEncodings).

I tried to provide text dataset into trainer while having datacollator, it gave me an error:  
transformers/tokenization\_utils\_base.py", line 3245, in pad  
raise ValueError(  
ValueError: You should supply an encoding or a list of encodings to this method that includes input\_ids, but you provided []
