Spaces:
Runtime error
Runtime error
rai-sant commited on
Commit ·
6b384dd
1
Parent(s): 361e067
Refactored __init__.py to include DataArguments and adjusted imports
Browse filesFiles changed (4)
14 unmodified lines1516171819202122232425262714 unmodified lines__version__ = "0.3.0.dev0"# Import necessary modules and classesfrom .configs import (DataArguments,DPOConfig,H4ArgumentParser,ModelArguments,SFTConfig,)from .data import apply_chat_template, get_datasetsfrom .decontaminate import decontaminate_humanevalfrom .model_utils import (14 unmodified lines151617181920212214 unmodified lines__version__ = "0.3.0.dev0"# Import necessary modules and classesfrom .configs.data_arguments import DataArguments # Ensure correct pathfrom .configs import DPOConfig, H4ArgumentParser, ModelArguments, SFTConfigfrom .data import apply_chat_template, get_datasetsfrom .decontaminate import decontaminate_humanevalfrom .model_utils import (
123456789101112class DataArguments: """ A placeholder class for DataArguments. Add relevant arguments and methods as needed. """
def __init__(self, dataset_path: str = None, max_samples: int = 1000): self.dataset_path = dataset_path self.max_samples = max_samples
def __repr__(self): return f"DataArguments(dataset_path={self.dataset_path}, max_samples={self.max_samples})"123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103# Copyright 2025 The HuggingFace Team. All rights reserved.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License."""Custom evaluation tasks for LightEval."""from lighteval.metrics.dynamic_metrics import (ExprExtractionConfig,LatexExtractionConfig,multilingual_extractive_match_metric,)from lighteval.tasks.lighteval_task import LightevalTaskConfigfrom lighteval.tasks.requests import Docfrom lighteval.utils.language import Languagelatex_gold_metric = multilingual_extractive_match_metric(language=Language.ENGLISH,fallback_mode="first_match",precision=5,gold_extraction_target=(LatexExtractionConfig(),),pred_extraction_target=(ExprExtractionConfig(), LatexExtractionConfig()),aggregation_function=max,)expr_gold_metric = multilingual_extractive_match_metric(language=Language.ENGLISH,fallback_mode="first_match",precision=5,gold_extraction_target=(ExprExtractionConfig(),),pred_extraction_target=(ExprExtractionConfig(), LatexExtractionConfig()),aggregation_function=max,)def prompt_fn(line, task_name: str = None):"""Assumes the model is either prompted to emit \\boxed{answer} or does so automatically"""return Doc(task_name=task_name,query=line["problem"],choices=[line["solution"]],gold_index=0,)def aime_prompt_fn(line, task_name: str = None):return Doc(task_name=task_name,query=line["problem"],choices=[line["answer"]],gold_index=0,)# Define tasksaime24 = LightevalTaskConfig(name="aime24",suite=["custom"],prompt_function=aime_prompt_fn,hf_repo="HuggingFaceH4/aime_2024",hf_subset="default",hf_avail_splits=["train"],evaluation_splits=["train"],few_shots_split=None,few_shots_select=None,generation_size=32768,metric=[expr_gold_metric],version=1,)math_500 = LightevalTaskConfig(name="math_500",suite=["custom"],prompt_function=prompt_fn,hf_repo="HuggingFaceH4/MATH-500",hf_subset="default",hf_avail_splits=["test"],evaluation_splits=["test"],few_shots_split=None,few_shots_select=None,generation_size=32768,metric=[latex_gold_metric],version=1,)# Add tasks to the tableTASKS_TABLE = []TASKS_TABLE.append(aime24)TASKS_TABLE.append(math_500)# MODULE LOGICif __name__ == "__main__":print([t["name"] for t in TASKS_TABLE])print(len(TASKS_TABLE))123456789101112class DataArguments:"""A placeholder class for DataArguments.Add relevant arguments and methods as needed."""def __init__(self, dataset_path: str = None, max_samples: int = 1000):self.dataset_path = dataset_pathself.max_samples = max_samplesdef __repr__(self):return f"DataArguments(dataset_path={self.dataset_path}, max_samples={self.max_samples})"
src/open_r1/.DS_Store
src/open_r1/__init__.py+2-7
src/open_r1/configs/data_arguments.pyAdded+12
src/open_r1/evaluate.py+12-103