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

Function eval_MMVet_benchmark

light-eval/src/eval_mmvet.py:133–167  ·  view source on GitHub ↗
(model, args)

Source from the content-addressed store, hash-verified

131 return text_output
132
133def eval_MMVet_benchmark(model, args):
134
135 answers_file = os.path.expanduser(args.answers_file)
136 results={}
137 os.makedirs(os.path.dirname(answers_file), exist_ok=True)
138 ans_file = open(answers_file, "w")
139
140 with open(args.question_file, "r") as file:
141 data = json.loads(file.read())
142 for key, value in data.items():
143 idx = key
144 image_file = value["imagename"]
145 qs=value["question"]
146
147 image_path = os.path.join(args.image_folder, image_file)
148 prompt = qs
149 times=0
150 output_text = generate_output(
151 model = model,
152 img_path = image_path,
153 prompt = prompt)
154
155 res= {
156 "idx": idx,
157 "output_text": output_text
158 }
159
160 key = idx
161 context= output_text
162 results[key] = context
163
164 output_json = json.dumps(results, indent=4)
165 ans_file.write(output_json)
166 ans_file.flush()
167 ans_file.close()
168
169
170

Callers 1

eval_mmvet.pyFile · 0.85

Calls 1

generate_outputFunction · 0.70

Tested by

no test coverage detected