# How to actually use padding in Lllama Tokenizers

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-actually-use-padding-in-lllama-tokenizers%2F39162%3E%5C
**Category:** 🤗Transformers\
**Created:** [May 9, 2023, 4:21am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-actually-use-padding-in-lllama-tokenizers%2F39162 "2023-05-09T04:21:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikalex](https://avatars.discourse-cdn.com/v4/letter/v/0ea827/32.png) [@vikalex](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fvikalex)%5C
**Post date:** [May 9, 2023, 4:21am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-actually-use-padding-in-lllama-tokenizers%2F39162%2F1 "2023-05-09T04:21:06Z")

</div>

I have been struggling to get padding to work properly with llama based models.

It seems like llama by default does not use a pad token. Does this mean that you simply can’t have batch\_size \> 1 ?

But some suggestions on github include to set pad\_token = eos\_token. But the issue with that is that pad\_token\_id is actually set in the generation\_config [generation\_config.json · lmsys/vicuna-13b-delta-v1.1 at main](https://huggingface.co/lmsys/vicuna-13b-delta-v1.1/blob/main/generation_config.json)

pad\_token\_id is set to 0. Why is there an inconsistency? Does this matter should I also set pad\_token\_id to eos\_token\_id?

Currently I simply set pad\_token = eos\_token, but keep the pad\_token\_id as 0 and am noticing poorer performance with batch inference as compared to single inference.

---

<div class="post-metadata">

**Author:** ![Hachem1](https://avatars.discourse-cdn.com/v4/letter/h/ecb155/32.png) [@Hachem1](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHachem1)%5C
**Post date:** [June 11, 2023, 3:23am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-actually-use-padding-in-lllama-tokenizers%2F39162%2F2 "2023-06-11T03:23:15Z")

</div>

@vikalex how did you manage to solve this issue ? help please !

---

<div class="post-metadata">

**Author:** ![vikalex](https://avatars.discourse-cdn.com/v4/letter/v/0ea827/32.png) [@vikalex](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fvikalex)%5C
**Post date:** [June 16, 2023, 5:46pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-actually-use-padding-in-lllama-tokenizers%2F39162%2F3 "2023-06-16T17:46:01Z")

</div>

I just set eos\_token to pad\_token and it doesn’t cause any issues as long as the model knows both of them and has a good stopping criteria.
