|
34 | 34 |
|
35 | 35 | import numpy as np
|
36 | 36 | from aenum import extend_enum
|
| 37 | +from datasets import get_dataset_config_names |
37 | 38 |
|
38 | 39 | from lighteval.metrics.metrics import MetricCategory, Metrics, MetricUseCase, SampleLevelMetric
|
39 | 40 | from lighteval.tasks.extended.lcb.codegen_metrics import (
|
@@ -114,21 +115,28 @@ def codegen_metric(predictions: list[str], formatted_doc: Doc, **kwargs) -> floa
|
114 | 115 |
|
115 | 116 | extend_enum(Metrics, "lcb_codegen_metric", lcb_codegen_metric)
|
116 | 117 |
|
117 |
| - |
118 |
| -task = LightevalTaskConfig( |
119 |
| - name="lcb:codegeneration", |
120 |
| - suite=["extended"], |
121 |
| - prompt_function=lcb_codegeneration_prompt_fn, |
122 |
| - hf_repo="livecodebench/code_generation_lite", |
123 |
| - hf_subset="v4_v5", # https://github.com/LiveCodeBench/LiveCodeBench/tree/main?tab=readme-ov-file#dataset-versions |
124 |
| - hf_avail_splits=["test"], |
125 |
| - evaluation_splits=["test"], |
126 |
| - generation_size=32768, |
127 |
| - metric=[Metrics.lcb_codegen_metric], |
128 |
| - stop_sequence=[], # no stop sequence, will use EOS token |
129 |
| - trust_dataset=True, |
130 |
| - version=0, |
131 |
| -) |
| 118 | +configs = get_dataset_config_names("livecodebench/code_generation_lite", trust_remote_code=True) |
| 119 | + |
| 120 | +tasks = [] |
| 121 | + |
| 122 | +for subset in configs: |
| 123 | + # To keep the base subset as the default, the others are named "lcb:codegeneration_v4", "lcb:codegeneration_v5"... etc |
| 124 | + name = "lcb:codegeneration" if subset == "v4_v5" else f"lcb:codegeneration_{subset}" |
| 125 | + task = LightevalTaskConfig( |
| 126 | + name=name, |
| 127 | + suite=["extended"], |
| 128 | + prompt_function=lcb_codegeneration_prompt_fn, |
| 129 | + hf_repo="livecodebench/code_generation_lite", |
| 130 | + hf_subset=subset, # https://github.com/LiveCodeBench/LiveCodeBench/tree/main?tab=readme-ov-file#dataset-versions |
| 131 | + hf_avail_splits=["test"], |
| 132 | + evaluation_splits=["test"], |
| 133 | + generation_size=32768, |
| 134 | + metric=[Metrics.lcb_codegen_metric], |
| 135 | + stop_sequence=[], # no stop sequence, will use EOS token |
| 136 | + trust_dataset=True, |
| 137 | + version=0, |
| 138 | + ) |
| 139 | + tasks.append(task) |
132 | 140 |
|
133 | 141 |
|
134 |
| -TASKS_TABLE = [task] |
| 142 | +TASKS_TABLE = tasks |
0 commit comments