mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
18 lines
529 B
Python
18 lines
529 B
Python
from typing import List, Optional
|
|
|
|
from datasets import Dataset, DatasetDict
|
|
|
|
from opencompass.datasets import BaseDataset
|
|
|
|
|
|
class LMEvalDataset(BaseDataset):
|
|
"""A dataset wrapper around the evaluator inputs, designed for
|
|
OpenCompass's internal use."""
|
|
|
|
@staticmethod
|
|
def load(predictions: List, references: Optional[List] = None):
|
|
content = {'prediction': predictions}
|
|
if references:
|
|
content['reference'] = references
|
|
return DatasetDict(dict(test=Dataset.from_dict(content)))
|