-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from epinzur/crag-datasets
added support for crag task_1 dataset
- Loading branch information
Showing
7 changed files
with
103 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
import os | ||
from typing import List | ||
|
||
from .base_dataset import BaseDataset | ||
from .crag_dataset import CragDataset | ||
from .llama_dataset import LlamaDataset | ||
|
||
|
||
# TODO: implement this when adding additional dataset kinds | ||
def find_dataset(name:str) -> BaseDataset: | ||
root_path = "datasets" | ||
name = name.lower() | ||
for kind in os.listdir(root_path): | ||
kind_path = os.path.join(root_path, kind) | ||
if os.path.isdir(kind_path): | ||
for dataset in os.listdir(kind_path): | ||
dataset_path = os.path.join(kind_path, dataset) | ||
if os.path.isdir(dataset_path): | ||
if dataset.lower() == name: | ||
return get_dataset(name, kind) | ||
|
||
""" searches for a downloaded dataset with this name. if found, returns it.""" | ||
return get_dataset(name, "llama") | ||
|
||
def get_dataset(name:str, kind:str) -> BaseDataset: | ||
kind = kind.lower() | ||
if kind == "llama": | ||
return LlamaDataset(dataset_name=name) | ||
elif kind == "crag": | ||
return CragDataset(dataset_name=name) | ||
|
||
raise NotImplementedError("only llama datasets are currently supported") | ||
raise NotImplementedError("only llama and crag datasets are currently supported") | ||
|