mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
[Fix] Update get_data_path for LCBench and HumanEval (#1375)
This commit is contained in:
parent
fea11b1d20
commit
eee5a5be23
@ -13,6 +13,7 @@ from datasets import DatasetDict, concatenate_datasets, load_dataset
|
|||||||
|
|
||||||
from opencompass.openicl.icl_evaluator import BaseEvaluator
|
from opencompass.openicl.icl_evaluator import BaseEvaluator
|
||||||
from opencompass.registry import ICL_EVALUATORS, LOAD_DATASET
|
from opencompass.registry import ICL_EVALUATORS, LOAD_DATASET
|
||||||
|
from opencompass.utils import get_data_path
|
||||||
|
|
||||||
from .base import BaseDataset
|
from .base import BaseDataset
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ class LCDataset(BaseDataset):
|
|||||||
num_repeats(int): Number of repetition for this dataset to get
|
num_repeats(int): Number of repetition for this dataset to get
|
||||||
multiple responses in special cases.
|
multiple responses in special cases.
|
||||||
"""
|
"""
|
||||||
|
path = get_data_path(path, local_mode=True)
|
||||||
|
|
||||||
def processing_test(example):
|
def processing_test(example):
|
||||||
example['test_case'] = example['test_list']
|
example['test_case'] = example['test_list']
|
||||||
|
@ -33,7 +33,7 @@ pip install -e evalplus'''
|
|||||||
class HumanevalDataset(BaseDataset):
|
class HumanevalDataset(BaseDataset):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load(path: str, num_repeats: int = 1):
|
def load(path: str, num_repeats: int = 1, local_mode: bool = False):
|
||||||
"""Load humaneval dataset for pass k mode.
|
"""Load humaneval dataset for pass k mode.
|
||||||
|
|
||||||
Note that you can use num_repeats > 1 when your model does not support
|
Note that you can use num_repeats > 1 when your model does not support
|
||||||
@ -49,7 +49,7 @@ class HumanevalDataset(BaseDataset):
|
|||||||
num_repeats(int): Number of repetition for this dataset to get
|
num_repeats(int): Number of repetition for this dataset to get
|
||||||
multiple responses in special cases.
|
multiple responses in special cases.
|
||||||
"""
|
"""
|
||||||
path = get_data_path(path)
|
path = get_data_path(path, local_mode=local_mode)
|
||||||
if environ.get('DATASET_SOURCE') == 'ModelScope':
|
if environ.get('DATASET_SOURCE') == 'ModelScope':
|
||||||
from modelscope import MsDataset
|
from modelscope import MsDataset
|
||||||
dataset = MsDataset.load(path, subset_name='openai_humaneval', split='test')
|
dataset = MsDataset.load(path, subset_name='openai_humaneval', split='test')
|
||||||
|
Loading…
Reference in New Issue
Block a user