Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider changing llama3 configs to left padding #398

Open
gmongaras opened this issue Jan 18, 2025 · 0 comments
Open

Consider changing llama3 configs to left padding #398

gmongaras opened this issue Jan 18, 2025 · 0 comments

Comments

@gmongaras
Copy link

Thanks for making this repo! Really helpful for a project I'm working on.

However, when generating in a batch, there are a couple of isses. The first is the missing parameter in the generation as mentioned here: #391

The above PR isn't really an issue, moreso an ambiguity. There is an issue with the llama3 tokenizer in that it uses a left-padding scheme. Using a right padding scheme results in bad or incorrect outputs when there are uneven batches as the pad tokens are used to generate the next token (idx -1 is selected by the HF code and this is a pad token). The huggingface configs can be changed to fix this issue. For example, changing this config. The only thing that needs to be changed is tokenizer_padding_side to be left instead of right. Alternatively, one can manually change this like the following:

overwrite_config = {"tokenizer_padding_side": "left"}
llava_tokenizer, llava_model, llava_image_processor, llava_max_length = load_pretrained_model(..., overwrite_config=overwrite_config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant