Add dump_metric to MMMU, lm-eval, and NeMo Skills eval paths (#22147)
This commit is contained in:
@@ -8,6 +8,7 @@ from sglang.test.test_utils import (
|
|||||||
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||||
DEFAULT_URL_FOR_TEST,
|
DEFAULT_URL_FOR_TEST,
|
||||||
ModelLaunchSettings,
|
ModelLaunchSettings,
|
||||||
|
dump_metric,
|
||||||
popen_launch_server,
|
popen_launch_server,
|
||||||
write_github_step_summary,
|
write_github_step_summary,
|
||||||
)
|
)
|
||||||
@@ -421,6 +422,12 @@ def _run_nemo_skills_eval(
|
|||||||
if score is None:
|
if score is None:
|
||||||
return False, "Could not parse accuracy from ns eval output", None
|
return False, "Could not parse accuracy from ns eval output", None
|
||||||
|
|
||||||
|
dump_metric(
|
||||||
|
f"{dataset}_score",
|
||||||
|
score,
|
||||||
|
labels={"model": model.model_path, "eval": dataset, "api": "nemo-skills"},
|
||||||
|
)
|
||||||
|
|
||||||
return True, None, {"score": score}
|
return True, None, {"score": score}
|
||||||
|
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import numpy as np
|
|||||||
import requests
|
import requests
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from sglang.test.test_utils import dump_metric
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def scoped_env_vars(new_env: dict[str, str] | None):
|
def scoped_env_vars(new_env: dict[str, str] | None):
|
||||||
@@ -69,6 +71,15 @@ class LMEvalMixin:
|
|||||||
f"ground_truth={ground_truth:.3f} | "
|
f"ground_truth={ground_truth:.3f} | "
|
||||||
f"measured={measured_value:.3f} | rtol={rtol}"
|
f"measured={measured_value:.3f} | rtol={rtol}"
|
||||||
)
|
)
|
||||||
|
dump_metric(
|
||||||
|
f"{task['name']}_{metric['name']}",
|
||||||
|
measured_value,
|
||||||
|
labels={
|
||||||
|
"model": eval_config.get("model_name", ""),
|
||||||
|
"eval": "lm-eval",
|
||||||
|
"task": task["name"],
|
||||||
|
},
|
||||||
|
)
|
||||||
success = success and np.isclose(
|
success = success and np.isclose(
|
||||||
ground_truth, measured_value, rtol=rtol
|
ground_truth, measured_value, rtol=rtol
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ from sglang.test.test_utils import (
|
|||||||
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||||
DEFAULT_URL_FOR_TEST,
|
DEFAULT_URL_FOR_TEST,
|
||||||
CustomTestCase,
|
CustomTestCase,
|
||||||
|
dump_metric,
|
||||||
popen_launch_server,
|
popen_launch_server,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -216,6 +217,12 @@ class MMMUMixin:
|
|||||||
mmmu_accuracy = result["results"]["mmmu_val"]["mmmu_acc,none"]
|
mmmu_accuracy = result["results"]["mmmu_val"]["mmmu_acc,none"]
|
||||||
print(f"Model {self.model} achieved accuracy: {mmmu_accuracy:.4f}")
|
print(f"Model {self.model} achieved accuracy: {mmmu_accuracy:.4f}")
|
||||||
|
|
||||||
|
dump_metric(
|
||||||
|
"mmmu_score",
|
||||||
|
mmmu_accuracy,
|
||||||
|
labels={"model": self.model, "eval": "mmmu", "api": "lmms-eval"},
|
||||||
|
)
|
||||||
|
|
||||||
# Assert performance meets expected threshold
|
# Assert performance meets expected threshold
|
||||||
self.assertGreaterEqual(
|
self.assertGreaterEqual(
|
||||||
mmmu_accuracy,
|
mmmu_accuracy,
|
||||||
@@ -403,6 +410,12 @@ class MMMUMultiModelTestBase(CustomTestCase):
|
|||||||
f"Model {model.model} achieved accuracy{test_name}: {mmmu_accuracy:.4f}"
|
f"Model {model.model} achieved accuracy{test_name}: {mmmu_accuracy:.4f}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
dump_metric(
|
||||||
|
"mmmu_score",
|
||||||
|
mmmu_accuracy,
|
||||||
|
labels={"model": model.model, "eval": "mmmu", "api": "lmms-eval"},
|
||||||
|
)
|
||||||
|
|
||||||
# Capture server output if requested
|
# Capture server output if requested
|
||||||
if capture_output and process:
|
if capture_output and process:
|
||||||
server_output = self._read_output_from_files()
|
server_output = self._read_output_from_files()
|
||||||
|
|||||||
Reference in New Issue
Block a user