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

Image token process malfunction #78

Open
Stevetich opened this issue Aug 12, 2024 · 0 comments
Open

Image token process malfunction #78

Stevetich opened this issue Aug 12, 2024 · 0 comments

Comments

@Stevetich
Copy link

It seems that in model_utils.py, only one token is passed in pllava_answer.

def pllava_answer(conv: Conversation, model, processor, img_list, do_sample=True, max_new_tokens=200, num_beams=1, min_length=1, top_p=0.9,
repetition_penalty=1.0, length_penalty=1, temperature=1.0, stop_criteria_keywords=None, print_res=False):
# torch.cuda.empty_cache()
prompt = conv.get_prompt()
inputs = processor(text=prompt, images=img_list, return_tensors="pt")
if inputs['pixel_values'] is None:
inputs.pop('pixel_values')
inputs = inputs.to(model.device)

However, in eval_utils, the multiple tokens are passed for the model to perform video inference. Is that a bug in model_utils.py?

def answer(self, conv: Conversation, img_list, max_new_tokens=200, num_beams=1, min_length=1, top_p=0.9,
repetition_penalty=1.0, length_penalty=1, temperature=1.0):
torch.cuda.empty_cache()
prompt = conv.get_prompt()
if prompt.count(conv.mm_token) < len(img_list):
diff_mm_num = len(img_list) - prompt.count(conv.mm_token)
for i in range(diff_mm_num):
conv.user_query("", is_mm=True)
prompt = conv.get_prompt()

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