# Padding should be True, please explain

**URL:** <https://discuss.huggingface.co/t/padding-should-be-true-please-explain/102837>\
**Category:** Beginners\
**Created:** [August 18, 2024, 9:04am UTC](https://discuss.huggingface.co/t/padding-should-be-true-please-explain/102837 "2024-08-18T09:04:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sanyam52](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sanyam52/32/30619_2.png) [@Sanyam52](https://discuss.huggingface.co/u/Sanyam52)\
**Post date:** [August 18, 2024, 9:04am UTC](https://discuss.huggingface.co/t/padding-should-be-true-please-explain/102837/1 "2024-08-18T09:04:03Z")

</div>

In the following code, why are we not making padding = True inside the tokenizer, because don’t we want all the lists to be of the same size?  
max\_length = 128

def preprocess\_function(examples):  
inputs = [ex[“en”] for ex in examples[“translation”]]  
targets = [ex[“fr”] for ex in examples[“translation”]]  
model\_inputs = tokenizer(  
inputs, text\_target=targets, max\_length=max\_length, truncation=True  
)  
return model\_inputs

---

<div class="post-metadata">

**Author:** ![Sanyam52](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sanyam52/32/30619_2.png) [@Sanyam52](https://discuss.huggingface.co/u/Sanyam52)\
**Post date:** [August 18, 2024, 9:07am UTC](https://discuss.huggingface.co/t/padding-should-be-true-please-explain/102837/2 "2024-08-18T09:07:04Z")

</div>

I just read up, padding is the job of DataCollator which pads -100 so that our loss function ignores it.  
Is this correct?
