Delete webuibench.py
Browse files- webuibench.py +0 -39
webuibench.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import datasets
|
| 3 |
-
import pandas as pd
|
| 4 |
-
|
| 5 |
-
class WebUIBench(datasets.GeneratorBasedBuilder):
|
| 6 |
-
BUILDER_CONFIG_CLASS = datasets.BuilderConfig
|
| 7 |
-
|
| 8 |
-
# 每个文件夹(除非以"."或"_"开头)都当作一个 subset
|
| 9 |
-
BUILDER_CONFIGS = [
|
| 10 |
-
datasets.BuilderConfig(name=subset, version=datasets.Version("1.0.0"), description=f"Subset: {subset}")
|
| 11 |
-
for subset in os.listdir(os.path.dirname(__file__))
|
| 12 |
-
if os.path.isdir(os.path.join(os.path.dirname(__file__), subset))
|
| 13 |
-
and not subset.startswith(".")
|
| 14 |
-
and not subset.startswith("_")
|
| 15 |
-
and os.path.exists(os.path.join(os.path.dirname(__file__), subset, "test-00000-of-00001.parquet"))
|
| 16 |
-
]
|
| 17 |
-
|
| 18 |
-
DEFAULT_CONFIG_NAME = BUILDER_CONFIGS[0].name if BUILDER_CONFIGS else None
|
| 19 |
-
|
| 20 |
-
def _info(self):
|
| 21 |
-
return datasets.DatasetInfo(
|
| 22 |
-
description="WebUIBench dataset with multiple subsets.",
|
| 23 |
-
features=datasets.Features({}), # 自动推断 feature
|
| 24 |
-
supervised_keys=None,
|
| 25 |
-
)
|
| 26 |
-
|
| 27 |
-
def _split_generators(self, dl_manager):
|
| 28 |
-
subset_path = os.path.join(os.path.dirname(__file__), self.config.name, "test-00000-of-00001.parquet")
|
| 29 |
-
return [
|
| 30 |
-
datasets.SplitGenerator(
|
| 31 |
-
name=datasets.Split.TEST,
|
| 32 |
-
gen_kwargs={"filepath": subset_path},
|
| 33 |
-
)
|
| 34 |
-
]
|
| 35 |
-
|
| 36 |
-
def _generate_examples(self, filepath):
|
| 37 |
-
df = pd.read_parquet(filepath)
|
| 38 |
-
for idx, row in df.iterrows():
|
| 39 |
-
yield idx, row.to_dict()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|