MCPcopy Create free account
hub / github.com/Alpha-VLLM/LLaMA2-Accessory / generate_output

Function generate_output

light-eval/src/eval_mmvet.py:116–131  ·  view source on GitHub ↗
(model, img_path, prompt)

Source from the content-addressed store, hash-verified

114
115@ torch.inference_mode()
116def generate_output(model, img_path, prompt):
117 print("image path:", img_path)
118 if img_path is not None:
119 image = Image.open(img_path).convert('RGB')
120 image = transform_val(image).unsqueeze(0)
121 else:
122 image = None
123 _prompt = format_prompt(prompt)
124
125 if image is not None:
126 image = image.cuda()
127
128 with torch.cuda.amp.autocast(dtype=torch.bfloat16):
129 results = model.generate([_prompt], image, max_gen_len=512, temperature=0.1, top_p=0.7)
130 text_output = results[0].strip()
131 return text_output
132
133def eval_MMVet_benchmark(model, args):
134

Callers 1

eval_MMVet_benchmarkFunction · 0.70

Calls 3

printFunction · 0.85
format_promptFunction · 0.70
generateMethod · 0.45

Tested by

no test coverage detected