VILA icon indicating copy to clipboard operation
VILA copied to clipboard

Why setting LLaMa3's padding direction to "right"?

Open ROIM1998 opened this issue 1 year ago • 2 comments

Hi! Really appreciate your great work.

I'm a bit confused of the padding_direction being set in LLaMA3's tokenizer.json file. As said in the comments, this is used in the model's repack function. Since LLaMA3 is a autoregressive model, why did you choose to pad the embeddings and placeholder labels to the right instead of left?

Also, padding to right raises an issue where the end of the input prompt is difficult to be identified during inference. If I want to finetune the model on my own dataset, will it still work if I change the padding side from right to left? Thanks!

ROIM1998 avatar Jun 06 '24 22:06 ROIM1998

Could you provide a link to the code of the padding behavior that you are asking about? Thanks.

yaolug avatar Jun 19 '24 07:06 yaolug

I'm curious too. I think @ROIM1998 is talking about here: https://github.com/NVlabs/VILA/blob/da98f3b98191540bbc52a9feea7102e1268b9c4c/llava/model/language_model/builder.py#L87-L108 There is also "tokenizer_padding_side": "right" from the config.json

JBurtn avatar Aug 04 '24 05:08 JBurtn