Datasets:
Convert dataset to Parquet
#2
by gahdritz - opened
README.md
CHANGED
|
@@ -5,7 +5,20 @@ configs:
|
|
| 5 |
data_files:
|
| 6 |
- split: test
|
| 7 |
path: summarization/test-*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
dataset_info:
|
|
|
|
| 9 |
features:
|
| 10 |
- name: source
|
| 11 |
dtype: string
|
|
@@ -23,6 +36,64 @@ dataset_info:
|
|
| 23 |
num_examples: 4200
|
| 24 |
download_size: 3026042
|
| 25 |
dataset_size: 5392937
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
---
|
| 27 |
|
| 28 |
Data for the SMeL Test benchmark (paper coming soon).
|
|
|
|
| 5 |
data_files:
|
| 6 |
- split: test
|
| 7 |
path: summarization/test-*
|
| 8 |
+
- config_name: qa_corrupted
|
| 9 |
+
data_files:
|
| 10 |
+
- split: test
|
| 11 |
+
path: qa_corrupted/test-*
|
| 12 |
+
- config_name: qa_rewritten
|
| 13 |
+
data_files:
|
| 14 |
+
- split: test
|
| 15 |
+
path: qa_rewritten/test-*
|
| 16 |
+
- config_name: summarization
|
| 17 |
+
data_files:
|
| 18 |
+
- split: test
|
| 19 |
+
path: summarization/test-*
|
| 20 |
dataset_info:
|
| 21 |
+
- config_name: default
|
| 22 |
features:
|
| 23 |
- name: source
|
| 24 |
dtype: string
|
|
|
|
| 36 |
num_examples: 4200
|
| 37 |
download_size: 3026042
|
| 38 |
dataset_size: 5392937
|
| 39 |
+
- config_name: qa_corrupted
|
| 40 |
+
features:
|
| 41 |
+
- name: source
|
| 42 |
+
dtype: string
|
| 43 |
+
- name: question
|
| 44 |
+
dtype: string
|
| 45 |
+
- name: answer
|
| 46 |
+
dtype: string
|
| 47 |
+
- name: passage
|
| 48 |
+
dtype: string
|
| 49 |
+
- name: entity
|
| 50 |
+
dtype: string
|
| 51 |
+
- name: entity_type
|
| 52 |
+
dtype: string
|
| 53 |
+
splits:
|
| 54 |
+
- name: test
|
| 55 |
+
num_bytes: 5505177
|
| 56 |
+
num_examples: 4200
|
| 57 |
+
download_size: 2471155
|
| 58 |
+
dataset_size: 5505177
|
| 59 |
+
- config_name: qa_rewritten
|
| 60 |
+
features:
|
| 61 |
+
- name: source
|
| 62 |
+
dtype: string
|
| 63 |
+
- name: question
|
| 64 |
+
dtype: string
|
| 65 |
+
- name: answer
|
| 66 |
+
dtype: string
|
| 67 |
+
- name: passage
|
| 68 |
+
dtype: string
|
| 69 |
+
- name: entity
|
| 70 |
+
dtype: string
|
| 71 |
+
- name: entity_type
|
| 72 |
+
dtype: string
|
| 73 |
+
splits:
|
| 74 |
+
- name: test
|
| 75 |
+
num_bytes: 5091326
|
| 76 |
+
num_examples: 4200
|
| 77 |
+
download_size: 2417759
|
| 78 |
+
dataset_size: 5091326
|
| 79 |
+
- config_name: summarization
|
| 80 |
+
features:
|
| 81 |
+
- name: source
|
| 82 |
+
dtype: string
|
| 83 |
+
- name: entity
|
| 84 |
+
dtype: string
|
| 85 |
+
- name: entity_type
|
| 86 |
+
dtype: string
|
| 87 |
+
- name: fact
|
| 88 |
+
dtype: string
|
| 89 |
+
- name: passage
|
| 90 |
+
dtype: string
|
| 91 |
+
splits:
|
| 92 |
+
- name: test
|
| 93 |
+
num_bytes: 5392937
|
| 94 |
+
num_examples: 4200
|
| 95 |
+
download_size: 2978637
|
| 96 |
+
dataset_size: 5392937
|
| 97 |
---
|
| 98 |
|
| 99 |
Data for the SMeL Test benchmark (paper coming soon).
|
qa/rewritten/test-00000-of-00001.parquet
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:fb7d29a0c6c320cb7fc1c616b314fbeb7c6f23abd6034d9acb80f09ccfa1ac31
|
| 3 |
-
size 2454983
|
|
|
|
|
|
|
|
|
|
|
|
{qa/corrupted → qa_corrupted}/test-00000-of-00001.parquet
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:874576add0f5f31c3a02f3661cfd90e65ebbdd2efb46f293b74ce58119eca778
|
| 3 |
+
size 2471155
|
{qa/ground_truth → qa_rewritten}/test-00000-of-00001.parquet
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4f359e6a47bd553d90d7aaf99f3dad2dc93ca2a3d784ecd9d517a1bde4dba01a
|
| 3 |
+
size 2417759
|
smel.py
DELETED
|
@@ -1,112 +0,0 @@
|
|
| 1 |
-
import datasets
|
| 2 |
-
from huggingface_hub import HfApi, HfFileSystem
|
| 3 |
-
import pyarrow.parquet as pq
|
| 4 |
-
|
| 5 |
-
_CITATION = """\
|
| 6 |
-
@misc{gahdritz_smel_2025,
|
| 7 |
-
author={Gustaf Ahdritz},
|
| 8 |
-
title={SMEL Dataset},
|
| 9 |
-
year={2025},
|
| 10 |
-
publisher={Hugging Face Hub},
|
| 11 |
-
url={https://huggingface.co/datasets/gahdritz/smel}
|
| 12 |
-
}
|
| 13 |
-
"""
|
| 14 |
-
|
| 15 |
-
_DESCRIPTION = "The SMeL Test"
|
| 16 |
-
_HOMEPAGE = "https://huggingface.co/datasets/gahdritz/smel"
|
| 17 |
-
_LICENSE = "cc_by_4.0"
|
| 18 |
-
_HF_DATASET_REPO_ID = "gahdritz/smel"
|
| 19 |
-
_BASE_URL_RESOLVE = f"https://huggingface.co/datasets/{_HF_DATASET_REPO_ID}/resolve/main/"
|
| 20 |
-
|
| 21 |
-
_FEATURES_QA = datasets.Features({
|
| 22 |
-
"source": datasets.Value("string"),
|
| 23 |
-
"question": datasets.Value("string"),
|
| 24 |
-
"answer": datasets.Value("string"),
|
| 25 |
-
"passage": datasets.Value("string"),
|
| 26 |
-
"entity": datasets.Value("string"),
|
| 27 |
-
"entity_type": datasets.Value("string"),
|
| 28 |
-
})
|
| 29 |
-
|
| 30 |
-
_FEATURES_SUMMARIZATION = datasets.Features({
|
| 31 |
-
"source": datasets.Value("string"),
|
| 32 |
-
"entity": datasets.Value("string"),
|
| 33 |
-
"entity_type": datasets.Value("string"),
|
| 34 |
-
"fact": datasets.Value("string"),
|
| 35 |
-
"passage": datasets.Value("string"),
|
| 36 |
-
})
|
| 37 |
-
|
| 38 |
-
class SmelConfig(datasets.BuilderConfig):
|
| 39 |
-
def __init__(self, name, description, features, data_path, **kwargs):
|
| 40 |
-
super(SmelConfig, self).__init__()
|
| 41 |
-
self.name = name
|
| 42 |
-
self.description = description
|
| 43 |
-
self.features = features
|
| 44 |
-
self.data_path = data_path
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
class SmelDataset(datasets.GeneratorBasedBuilder):
|
| 48 |
-
"""SMeL dataset."""
|
| 49 |
-
|
| 50 |
-
BUILDER_CONFIGS = [
|
| 51 |
-
SmelConfig(
|
| 52 |
-
name="summarization",
|
| 53 |
-
description="Summarization tasks.",
|
| 54 |
-
features=_FEATURES_SUMMARIZATION,
|
| 55 |
-
data_path="summarization/",
|
| 56 |
-
),
|
| 57 |
-
SmelConfig(
|
| 58 |
-
name="qa_rewritten",
|
| 59 |
-
description="Rewritten Question Answering tasks.",
|
| 60 |
-
features=_FEATURES_QA,
|
| 61 |
-
data_path="qa/rewritten",
|
| 62 |
-
),
|
| 63 |
-
SmelConfig(
|
| 64 |
-
name="qa_corrupted",
|
| 65 |
-
description="Corrupted Question Answering tasks.",
|
| 66 |
-
features=_FEATURES_QA,
|
| 67 |
-
data_path="qa/corrupted",
|
| 68 |
-
),
|
| 69 |
-
]
|
| 70 |
-
|
| 71 |
-
def _info(self):
|
| 72 |
-
return datasets.DatasetInfo(
|
| 73 |
-
description=_DESCRIPTION,
|
| 74 |
-
features=self.config.features,
|
| 75 |
-
homepage=_HOMEPAGE,
|
| 76 |
-
license=_LICENSE,
|
| 77 |
-
citation=_CITATION,
|
| 78 |
-
)
|
| 79 |
-
|
| 80 |
-
def _split_generators(self, dl_manager):
|
| 81 |
-
"""Returns SplitGenerators."""
|
| 82 |
-
fs = HfFileSystem() # Initialize the Hugging Face FileSystem
|
| 83 |
-
repo_path = f"datasets/{_HF_DATASET_REPO_ID}/" # Base path on the HF Filesystem
|
| 84 |
-
all_files_in_path = fs.ls(repo_path + self.config.data_path, detail=False)
|
| 85 |
-
parquet_files = [f for f in all_files_in_path if f.endswith('.parquet')]
|
| 86 |
-
|
| 87 |
-
data_urls = [
|
| 88 |
-
_BASE_URL_RESOLVE + f.replace(f"datasets/{_HF_DATASET_REPO_ID}/", "")
|
| 89 |
-
for f in parquet_files
|
| 90 |
-
]
|
| 91 |
-
|
| 92 |
-
downloaded_files = dl_manager.download_and_extract(data_urls)
|
| 93 |
-
|
| 94 |
-
return [
|
| 95 |
-
datasets.SplitGenerator(
|
| 96 |
-
name=datasets.Split.TEST,
|
| 97 |
-
gen_kwargs={
|
| 98 |
-
"filepaths": downloaded_files,
|
| 99 |
-
},
|
| 100 |
-
),
|
| 101 |
-
]
|
| 102 |
-
|
| 103 |
-
def _generate_examples(self, filepaths):
|
| 104 |
-
"""Yields examples."""
|
| 105 |
-
example_idx = 0
|
| 106 |
-
for filepath in filepaths:
|
| 107 |
-
table = pq.read_table(filepath)
|
| 108 |
-
pa_df = table.to_pandas()
|
| 109 |
-
|
| 110 |
-
for _, row in pa_df.iterrows():
|
| 111 |
-
yield example_idx, row.to_dict()
|
| 112 |
-
example_idx += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
summarization/test-00000-of-00001.parquet
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:8ea71ec20064f63a1dc4f43e3c4bced929b87f9f052346b2b64e3ff137c9997d
|
| 3 |
-
size 3026042
|
|
|
|
|
|
|
|
|
|
|
|