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

LLaVA predictions are always empty #1

Closed
icrto opened this issue Apr 18, 2024 · 2 comments
Closed

LLaVA predictions are always empty #1

icrto opened this issue Apr 18, 2024 · 2 comments

Comments

@icrto
Copy link

icrto commented Apr 18, 2024

Thanks for the awesome paper and repo!

I was trying out LLaVA and noticed that the model predictions were always empty strings, and was able to narrow it down to this line

predicted_answers = tokenizer.batch_decode(generated_ids[:, input_token_len:], skip_special_tokens=True)[0]
.

It seems LLaVA already outputs only the tokens it generated, and not the whole context tokens + generated tokens.

The fix is quite easy, just decode the whole generated sentence, without truncating it first with the input_token_len.

Is my thinking correct or am I missing something?

@ys-zong
Copy link
Owner

ys-zong commented Apr 18, 2024

Hi, thanks for your interest. I think that's due to different versions of Llava - the older version I used when developing this repo seems to need this slicing (I'll need to double check it). But if decoding the whole generated sentence works for you, that's totally fine to just go without truncation.

@icrto
Copy link
Author

icrto commented Apr 18, 2024

Ah I see thanks!

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

2 participants