mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-02 08:44:44 +00:00
datasetdef files
This commit is contained in:
parent
d75095033d
commit
b946afddc0
3 changed files with 29 additions and 16 deletions
|
@ -0,0 +1,5 @@
|
||||||
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
|
# the root directory of this source tree.
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
from llama_models.llama3.api.datatypes import URL
|
||||||
|
from llama_stack.apis.common.type_system import StringType
|
||||||
|
from llama_stack.apis.datasetio import DatasetDef
|
||||||
|
|
||||||
|
|
||||||
|
llamastack_mmlu = DatasetDef(
|
||||||
|
identifier="llamastack_mmlu",
|
||||||
|
url=URL(uri="https://huggingface.co/datasets/yanxi0830/ls-mmlu"),
|
||||||
|
dataset_schema={
|
||||||
|
"expected_answer": StringType(),
|
||||||
|
"input_query": StringType(),
|
||||||
|
"generated_answer": StringType(),
|
||||||
|
},
|
||||||
|
metadata={"path": "yanxi0830/ls-mmlu", "split": "train"},
|
||||||
|
)
|
|
@ -5,16 +5,13 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from llama_models.llama3.api.datatypes import * # noqa: F403
|
|
||||||
|
|
||||||
from llama_stack.apis.datasetio import * # noqa: F403
|
from llama_stack.apis.datasetio import * # noqa: F403
|
||||||
|
|
||||||
from datasets import load_dataset
|
from datasets import load_dataset
|
||||||
|
|
||||||
from llama_stack.apis.common.type_system import StringType
|
|
||||||
from llama_stack.providers.datatypes import DatasetsProtocolPrivate
|
from llama_stack.providers.datatypes import DatasetsProtocolPrivate
|
||||||
|
|
||||||
from .config import HuggingfaceDatasetIOConfig
|
from .config import HuggingfaceDatasetIOConfig
|
||||||
|
from .dataset_defs.llamastack_mmlu import llamastack_mmlu
|
||||||
|
|
||||||
|
|
||||||
class HuggingfaceDatasetIOImpl(DatasetIO, DatasetsProtocolPrivate):
|
class HuggingfaceDatasetIOImpl(DatasetIO, DatasetsProtocolPrivate):
|
||||||
|
@ -25,18 +22,8 @@ class HuggingfaceDatasetIOImpl(DatasetIO, DatasetsProtocolPrivate):
|
||||||
|
|
||||||
async def initialize(self) -> None:
|
async def initialize(self) -> None:
|
||||||
# pre-registered benchmark datasets
|
# pre-registered benchmark datasets
|
||||||
self.dataset_infos = {
|
self.pre_registered_datasets = [llamastack_mmlu]
|
||||||
"mmlu": DatasetDef(
|
self.dataset_infos = {x.identifier: x for x in self.pre_registered_datasets}
|
||||||
identifier="mmlu",
|
|
||||||
url=URL(uri="https://huggingface.co/datasets/yanxi0830/ls-mmlu"),
|
|
||||||
dataset_schema={
|
|
||||||
"expected_answer": StringType(),
|
|
||||||
"input_query": StringType(),
|
|
||||||
"generated_answer": StringType(),
|
|
||||||
},
|
|
||||||
metadata={"path": "yanxi0830/ls-mmlu", "split": "train"},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
async def shutdown(self) -> None: ...
|
async def shutdown(self) -> None: ...
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue