MCPcopy Create free account
hub / github.com/DataArcTech/DataArc-SynData-Toolkit / eval

Function eval

sdgsystem/cli.py:98–158  ·  view source on GitHub ↗

Evaluate a post-trained model using DeepEval. \b Example: sdg eval configs/eval.yaml sdg eval configs/eval.yaml --model ./checkpoints/merged_model \b Supports three metrics: - Answer Correctness (G-Eval) - Pairwise Preference (Arena G-Eval) - Format Comp

(
    config_file: str,
    dataset: str | None,
    model: str | None,
    output: str | None,
)

Source from the content-addressed store, hash-verified

96@click.option("--output", "-o", type=click.Path(), default=None,
97 help="Override output directory")
98def eval(
99 config_file: str,
100 dataset: str | None,
101 model: str | None,
102 output: str | None,
103) -> None:
104 """Evaluate a post-trained model using DeepEval.
105
106 \b
107 Example:
108 sdg eval configs/eval.yaml
109 sdg eval configs/eval.yaml --model ./checkpoints/merged_model
110
111 \b
112 Supports three metrics:
113 - Answer Correctness (G-Eval)
114 - Pairwise Preference (Arena G-Eval)
115 - Format Compliance (G-Eval)
116
117 \b
118 Note: For verl checkpoints, merge to HuggingFace format first:
119 python -m verl.model_merger merge --backend fsdp --local_dir <checkpoint> --target_dir <output>
120 """
121 from .deepeval import DeepEvalConfig, DeepEvalEvaluator
122
123 # Load config from YAML
124 config = DeepEvalConfig.from_yaml(config_file)
125
126 # Apply CLI overrides
127 if dataset is not None:
128 config.dataset.path = dataset
129 if model is not None:
130 config.post_trained_model.config.path = model
131 if output is not None:
132 config.output.dir = output
133
134 click.echo("Starting DeepEval evaluation...")
135 click.echo(f" Test Dataset: {config.dataset.path}")
136 click.echo(f" Post-trained Model: {config.post_trained_model.config.path}")
137 click.echo(f" Judge Model: {config.judge_model}")
138 click.echo(f" Output: {config.output.dir}")
139
140 # Show enabled metrics
141 metrics = []
142 if config.correctness.enabled:
143 metrics.append("Answer Correctness")
144 if config.pairwise.enabled:
145 metrics.append("Pairwise Preference")
146 if config.format_compliance.enabled:
147 metrics.append("Format Compliance")
148 click.echo(f" Metrics: {', '.join(metrics)}")
149
150 try:
151 evaluator = DeepEvalEvaluator(config)
152 results = evaluator.run()
153
154 click.echo(click.style("Evaluation completed successfully!", fg="green"))
155

Callers 5

handle_piFunction · 0.85
math_equalFunction · 0.85
_parse_keyword_listMethod · 0.85

Calls 3

runMethod · 0.95
DeepEvalEvaluatorClass · 0.85
from_yamlMethod · 0.45

Tested by

no test coverage detected