Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support devops-eval #762

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
4 changes: 4 additions & 0 deletions configs/datasets/devops_eval/devops_eval_gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from mmengine.config import read_base

with read_base():
from .devops_eval_gen_8df36d import devops_eval_datasets # noqa: F401, F403
4 changes: 4 additions & 0 deletions configs/datasets/devops_eval/devops_eval_ppl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from mmengine.config import read_base

with read_base():
from .devops_eval_ppl_8b3a0d import devops_eval_datasets # noqa: F401, F403
28 changes: 28 additions & 0 deletions opencompass/datasets/devops_eval.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import csv
import os.path as osp

from datasets import Dataset, DatasetDict

from opencompass.registry import LOAD_DATASET

from .base import BaseDataset


@LOAD_DATASET.register_module()
class DevOpsEvalDataset(BaseDataset):

@staticmethod
def load(path: str, name: str, language: str):
dataset = {}
for split in ['dev', 'test']:
filename = osp.join(path, language, split, f'{name}.csv')
with open(filename, encoding='utf-8') as f:
reader = csv.reader(f)
header = next(reader)
for row in reader:
item = dict(zip(header, row))
item.setdefault('explanation', '')
item.setdefault('answer', '')
dataset.setdefault(split, []).append(item)
dataset = {i: Dataset.from_list(dataset[i]) for i in dataset}
return DatasetDict(dataset)