# BioGPT error with right padding

**URL:** <https://discuss.huggingface.co/t/biogpt-error-with-right-padding/49883>\
**Category:** 🤗Transformers\
**Created:** [August 7, 2023, 11:14pm UTC](https://discuss.huggingface.co/t/biogpt-error-with-right-padding/49883 "2023-08-07T23:14:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sidpillai11](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@sidpillai11](https://discuss.huggingface.co/u/sidpillai11)\
**Post date:** [August 7, 2023, 11:14pm UTC](https://discuss.huggingface.co/t/biogpt-error-with-right-padding/49883/1 "2023-08-07T23:14:08Z")

</div>

When I import the BioGPT tokenizer, why is padding\_side right by default, even though BioGPT architecture is decoder-only? When I try to pass batch inputs, PyTorch throws a warning saying generations may be faulty if right-padding is used.  
This is what the HuggingFace docs say: BioGPT is a model with absolute position embeddings so it’s usually advised to pad the inputs on the right rather than the left.

This is the warning message printed :  
example\_inputs = [‘the worst heart problems are’, 'epiglottis cancer with a ']  
example\_inputs\_tokenized = tokenizer(example\_inputs, padding =True, return\_tensors=“pt”).to(device)  
example\_outputs = base\_model.generate(\*\*example\_inputs\_tokenized, max\_length = 100)  
tokenizer.batch\_decode(example\_outputs, skip\_special\_tokens= True)

output →   
A decoder-only architecture is being used, but right-padding was detected! For correct generation results, please set `padding_side='left'` when initializing the tokenizer.  
[‘the worst heart problems are.’,  
‘epiglottis cancer with a review of the literature.’]
