Dataset Conversion¶
convert_to_hf(meld_data_path, output_data_path, data_filter=None, label_mapping=None, dataset_card_template=None, pretty_name=None, extra_files=None)
¶
Convert MELD datasets to Hugging Face format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meld_data_path
|
PathLike | str
|
Path to the MELD dataset directory. |
required |
output_data_path
|
PathLike | str
|
Output directory for the converted HF dataset. |
required |
data_filter
|
SplitFilter | None
|
Optional filter to include only specific splits. |
None
|
label_mapping
|
LabelMap | None
|
Optional mapping to normalize entity type labels. |
None
|
dataset_card_template
|
str | None
|
Optional custom template for the dataset card. If not provided, a minimal default template will be used. The template should contain: - {{ card_data }} within YAML frontmatter at the top of the template - {{ pretty_name }}: Will be replaced with the human-readable dataset name |
None
|
pretty_name
|
str | None
|
Optional pretty name for the dataset card. If not provided, the output directory name will be used as the pretty name. |
None
|
extra_files
|
dict[str, list[str]] | None
|
Lists of additional files per dataset to include in their output directories, such as licenses |
None
|
Source code in meld/hf_dataset_conversion.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
dataset_filter(keep_datasets)
¶
Create a filter function that keeps only splits from the specified datasets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keep_datasets
|
set[str]
|
Set of dataset names to keep. |
required |
Returns:
| Type | Description |
|---|---|
SplitFilter
|
A SplitFilter function that returns True for splits belonging to the specified datasets. |
Source code in meld/hf_dataset_conversion.py
hf_config_name(dataset_name, subset_hierarchy)
¶
Generate a Hugging Face configuration name from a dataset name and subset hierarchy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_name
|
str
|
Name of the dataset. |
required |
subset_hierarchy
|
list[str]
|
List of subset names forming the hierarchy. |
required |
Returns:
| Type | Description |
|---|---|
str
|
A single identifier for a Hugging Face dataset config, |
str
|
consisting of the dataset name and subset hierarchy joined by double hyphens. |