(model, args)
| 131 | return text_output |
| 132 | |
| 133 | def 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 |
no test coverage detected