mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-08 19:10:56 +00:00
evals new rebase
This commit is contained in:
parent
89d24a07f0
commit
31c046dcdf
28 changed files with 1141 additions and 87 deletions
|
|
@ -0,0 +1,32 @@
|
|||
# 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 typing import AbstractSet, Dict
|
||||
|
||||
from .dataset import BaseDataset
|
||||
|
||||
|
||||
class DatasetRegistry:
|
||||
_REGISTRY: Dict[str, BaseDataset] = {}
|
||||
|
||||
@staticmethod
|
||||
def names() -> AbstractSet[str]:
|
||||
return DatasetRegistry._REGISTRY.keys()
|
||||
|
||||
@staticmethod
|
||||
def register(name: str, task: BaseDataset) -> None:
|
||||
if name in DatasetRegistry._REGISTRY:
|
||||
raise ValueError(f"Dataset {name} already exists.")
|
||||
DatasetRegistry._REGISTRY[name] = task
|
||||
|
||||
@staticmethod
|
||||
def get_dataset(name: str) -> BaseDataset:
|
||||
if name not in DatasetRegistry._REGISTRY:
|
||||
raise ValueError(f"Dataset {name} not found.")
|
||||
return DatasetRegistry._REGISTRY[name]
|
||||
|
||||
@staticmethod
|
||||
def reset() -> None:
|
||||
DatasetRegistry._REGISTRY = {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue