LLaVA
LLaVA copied to clipboard
[Feature request] The param `no_repeat_ngram_size` should set in eval_model() func
feature
The latest version of the sample code for LLaVA could not set the param for ngram repeat size. When we implement this model, we want to analyze the effects of ngram repeat. Hence, I think we should modify a model generation @ eval_model() function like the following codes.(Line 114-L125)
with torch.inference_mode():
output_ids = model.generate(
input_ids,
images=images_tensor,
do_sample=True if args.temperature > 0 else False,
temperature=args.temperature,
top_p=args.top_p,
num_beams=args.num_beams,
max_new_tokens=args.max_new_tokens,
use_cache=True,
stopping_criteria=[stopping_criteria],
no_repeat_ngram_size=args.no_repeat_ngram_size,
)
Of course, the example code of LLaVA should be modified like the following codes.
model_path = "liuhaotian/llava-v1.5-7b"
prompt = "What are the things I should be cautious about when I visit here?"
image_file = "https://llava-vl.github.io/static/images/view.jpg"
args = type('Args', (), {
"model_path": model_path,
"model_base": None,
"model_name": get_model_name_from_path(model_path),
"query": prompt,
"conv_mode": None,
"image_file": image_file,
"sep": ",",
"temperature": 0,
"top_p": None,
"num_beams": 1,
"max_new_tokens": 512,
"no_repeat_ngram_size", 3
})()
eval_model(args)