MCPcopy Create free account
hub / github.com/CodeGoat24/UniGenBench / call_evaluation_vllm

Function call_evaluation_vllm

eval/src/eval_common.py:337–374  ·  view source on GitHub ↗

Evaluate a single image using a local vLLM server.

(task)

Source from the content-addressed store, hash-verified

335# ============================================================
336
337def call_evaluation_vllm(task):
338 """Evaluate a single image using a local vLLM server."""
339 from vllm_request import evaluate_batch
340
341 index = task["index"]
342 prompt = task["prompt"]
343 testpoint = task["testpoint"]
344 test_desc = task["test_desc"]
345 img_path = task["img_path"]
346 lang = task["lang"]
347 max_retries = task["max_retries"]
348 api_url = task["api_url"]
349
350 system_prompt = build_system_prompt(prompt, testpoint, test_desc, lang)
351 payload = [{"images": [img_path], "problem": system_prompt}]
352
353 text = None
354 for attempt in range(max_retries + 1):
355 result = evaluate_batch(payload, api_url)[0]
356
357 if not result.get("success"):
358 print(f"vLLM request failed (attempt {attempt + 1}/{max_retries + 1})")
359 continue
360
361 text = result["model_output"]
362 parsed = parse_evaluation_response(text, testpoint)
363 if parsed is not None:
364 analysis, score = parsed
365 result_json = {
366 "prompt": prompt,
367 "testpoint": testpoint,
368 "analysis": analysis,
369 "score": score,
370 }
371 return make_result(index, testpoint, prompt, img_path, text, result_json)
372
373 # All retries exhausted
374 return make_result(index, testpoint, prompt, img_path, text)
375
376
377# ============================================================

Callers

nothing calls this directly

Calls 4

evaluate_batchFunction · 0.90
build_system_promptFunction · 0.85
make_resultFunction · 0.85

Tested by

no test coverage detected