# Pass tokenizer to Trainer when data is already tokenized?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpass-tokenizer-to-trainer-when-data-is-already-tokenized%2F52201%3E%5C
**Category:** Beginners\
**Created:** [August 25, 2023, 5:37pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpass-tokenizer-to-trainer-when-data-is-already-tokenized%2F52201 "2023-08-25T17:37:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alonmiz](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/alonmiz/32/18708_2.png) [@alonmiz](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Falonmiz)%5C
**Post date:** [August 25, 2023, 5:37pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpass-tokenizer-to-trainer-when-data-is-already-tokenized%2F52201%2F1 "2023-08-25T17:37:49Z")

</div>

I tokenize the dataset as follows:

> cola = datasets.load\_dataset(‘linxinyuan/cola’)  
> cola\_tokenized = cola.map(lambda examples: tokenizer(examples[‘text’], padding=True, truncation=True), batched=True, batch\_size=16)

however, if do not pass tokenizer=cola\_tokenizer to Trainer arguments I get an error about tensors size mismatches.

Why do I need to pass the tokenizer to Trainer if my data is already tokenized?
