Add files using upload-large-folder tool
Browse files- README.md +223 -0
- data/IDBalanced/test-00000-of-00001.parquet +3 -0
- data/MetaSet/test-00000-of-00001.parquet +3 -0
- data/OODPrompts/test-00000-of-00001.parquet +3 -0
- data/StyleInstructCaps/eval-00000-of-00001.parquet +3 -0
- data/StyleInstructCaps/train-00000-of-00011.parquet +3 -0
- data/StyleInstructCaps/train-00001-of-00011.parquet +3 -0
- data/StyleInstructCaps/train-00002-of-00011.parquet +3 -0
- data/StyleInstructCaps/train-00003-of-00011.parquet +3 -0
- data/StyleInstructCaps/train-00004-of-00011.parquet +3 -0
- data/StyleInstructCaps/train-00005-of-00011.parquet +3 -0
- data/StyleInstructCaps/train-00006-of-00011.parquet +3 -0
- data/StyleInstructCaps/train-00007-of-00011.parquet +3 -0
- data/StyleInstructCaps/train-00008-of-00011.parquet +3 -0
- data/StyleInstructCaps/train-00009-of-00011.parquet +3 -0
- data/StyleInstructCaps/train-00010-of-00011.parquet +3 -0
- data/UDVCTK/test-00000-of-00001.parquet +3 -0
- data/UnseenEval/test-00000-of-00001.parquet +3 -0
- hf_release_for_spkcap_6e6bb298.plan.md +148 -0
- scripts/prepare_release.py +295 -0
- scripts/requirements.txt +6 -0
- scripts/upload_to_hf.py +67 -0
README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
task_categories:
|
| 6 |
+
- text-to-speech
|
| 7 |
+
configs:
|
| 8 |
+
- config_name: StyleInstructCaps
|
| 9 |
+
data_files:
|
| 10 |
+
- split: train
|
| 11 |
+
path: data/StyleInstructCaps/train-*.parquet
|
| 12 |
+
- split: eval
|
| 13 |
+
path: data/StyleInstructCaps/eval-*.parquet
|
| 14 |
+
- config_name: OODPrompts
|
| 15 |
+
data_files:
|
| 16 |
+
- split: test
|
| 17 |
+
path: data/OODPrompts/test-*.parquet
|
| 18 |
+
- config_name: MetaSet
|
| 19 |
+
data_files:
|
| 20 |
+
- split: test
|
| 21 |
+
path: data/MetaSet/test-*.parquet
|
| 22 |
+
- config_name: IDBalanced
|
| 23 |
+
data_files:
|
| 24 |
+
- split: test
|
| 25 |
+
path: data/IDBalanced/test-*.parquet
|
| 26 |
+
- config_name: UDVCTK
|
| 27 |
+
data_files:
|
| 28 |
+
- split: test
|
| 29 |
+
path: data/UDVCTK/test-*.parquet
|
| 30 |
+
- config_name: UnseenEval
|
| 31 |
+
data_files:
|
| 32 |
+
- split: test
|
| 33 |
+
path: data/UnseenEval/test-*.parquet
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
# StyleInstructCaps
|
| 37 |
+
|
| 38 |
+
Style-captioned speech metadata for speaking-style captioning and instruction-following evaluation, packaged in a [CapSpeech](https://huggingface.co/datasets/OpenSound/CapSpeech)-style Hugging Face dataset layout.
|
| 39 |
+
|
| 40 |
+
**Repository placeholder:** `<HF_ORG>/<DATASET_NAME>`
|
| 41 |
+
|
| 42 |
+
## Overview
|
| 43 |
+
|
| 44 |
+
This dataset release contains style captions, transcriptions, tags, and instruction prompts for speech captioning research. It includes:
|
| 45 |
+
|
| 46 |
+
- **StyleInstructCaps** — large-scale training and evaluation splits with rich style annotations
|
| 47 |
+
- **OODPrompts** — out-of-distribution prompt evaluation on VCTK (32 utterances, 36 instruction prompts per row)
|
| 48 |
+
- **MetaSet** — evaluation subset derived from the Eval-500 benchmark (434 utterances with full style and instruction fields)
|
| 49 |
+
- **IDBalanced** — in-distribution, accent/gender-balanced evaluation set
|
| 50 |
+
- **UDVCTK** — VCTK evaluation with 10 speaker-idiosyncratic style prompts
|
| 51 |
+
- **UnseenEval** — unseen GigaSpeech-style evaluation set with ground-truth captions
|
| 52 |
+
|
| 53 |
+
This is a **metadata-only** release. Audio is **not** redistributed. Each row includes a `relative_audio_path` that should be resolved against the corresponding upstream audio corpus listed below.
|
| 54 |
+
|
| 55 |
+
During release preparation, local absolute `audio_path` values are removed, mixed string/list fields are normalized to consistent types, and numeric fields (`duration`, `snr`, `utterance_pitch_mean`) are stored as `float64`.
|
| 56 |
+
|
| 57 |
+
## License
|
| 58 |
+
|
| 59 |
+
All resources are released under the [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) license.
|
| 60 |
+
|
| 61 |
+
## Usage
|
| 62 |
+
|
| 63 |
+
```python
|
| 64 |
+
from datasets import load_dataset
|
| 65 |
+
|
| 66 |
+
REPO = "<HF_ORG>/<DATASET_NAME>"
|
| 67 |
+
|
| 68 |
+
# Load a specific config and split
|
| 69 |
+
train = load_dataset(REPO, "StyleInstructCaps", split="train")
|
| 70 |
+
eval_split = load_dataset(REPO, "StyleInstructCaps", split="eval")
|
| 71 |
+
|
| 72 |
+
# Load evaluation configs
|
| 73 |
+
ood = load_dataset(REPO, "OODPrompts", split="test")
|
| 74 |
+
metaset = load_dataset(REPO, "MetaSet", split="test")
|
| 75 |
+
id_balanced = load_dataset(REPO, "IDBalanced", split="test")
|
| 76 |
+
ud_vctk = load_dataset(REPO, "UDVCTK", split="test")
|
| 77 |
+
unseen = load_dataset(REPO, "UnseenEval", split="test")
|
| 78 |
+
|
| 79 |
+
# Inspect one example
|
| 80 |
+
print(train[0])
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
## Dataset Structure
|
| 84 |
+
|
| 85 |
+
Each config is stored as parquet files under `data/<config>/`. Local absolute `audio_path` values from the original manifests are **not** included; use `relative_audio_path` to locate audio in upstream datasets.
|
| 86 |
+
|
| 87 |
+
### StyleInstructCaps
|
| 88 |
+
|
| 89 |
+
| Split | Rows | Description |
|
| 90 |
+
| ----- | ---- | ----------- |
|
| 91 |
+
| `train` | 1,031,840 | Full-scale training set with style captions and tags (11 parquet shards) |
|
| 92 |
+
| `eval` | 14,756 | Held-out evaluation set with style captions, tags, and instruction fields |
|
| 93 |
+
|
| 94 |
+
**Shared columns (train and eval)**
|
| 95 |
+
|
| 96 |
+
| Column | Type | Description |
|
| 97 |
+
| ------ | ---- | ----------- |
|
| 98 |
+
| `source` | string | Upstream dataset identifier (e.g., `emilia`, `voxceleb`, `ears`, `expresso`) |
|
| 99 |
+
| `relative_audio_path` | string | Relative path to the audio file within the upstream corpus |
|
| 100 |
+
| `transcription` | string | Transcript of the utterance |
|
| 101 |
+
| `text_description` | list[string] | Natural-language style caption(s) |
|
| 102 |
+
| `speaker_idiosyncratic_style` | string | Speaker identity style caption |
|
| 103 |
+
| `situational_contextual_style` | string | Situational/contextual style caption |
|
| 104 |
+
| `expressive_emotional_style` | string | Expressive/emotional style caption |
|
| 105 |
+
| `linguistic_pragmatic_style` | string | Linguistic/pragmatic style caption |
|
| 106 |
+
| `perceptual_listener_centric_style` | string | Listener-centric style caption |
|
| 107 |
+
| `holistic_creative_synthesis` | string | Holistic creative synthesis caption |
|
| 108 |
+
| `intrinsic_tags` | list[string] | Intrinsic style tags |
|
| 109 |
+
| `situational_tags` | list[string] | Situational tags (empty list when absent) |
|
| 110 |
+
| `basic_tags` | list[string] | Basic attribute tags |
|
| 111 |
+
| `all_tags` | list[string] | Combined tag set |
|
| 112 |
+
| `speakerid` | string | Speaker identifier |
|
| 113 |
+
| `name` | string | Speaker name (when available) |
|
| 114 |
+
| `duration` | float | Utterance duration in seconds |
|
| 115 |
+
| `gender` | string | Gender label |
|
| 116 |
+
| `accent` | string | Accent label (empty string when absent) |
|
| 117 |
+
| `pitch` | string | Pitch descriptor |
|
| 118 |
+
| `speaking_rate` | string | Speaking-rate descriptor |
|
| 119 |
+
| `noise` | string | Recording environment descriptor |
|
| 120 |
+
| `utterance_pitch_mean` | float | Mean pitch (Hz) |
|
| 121 |
+
| `snr` | float | Signal-to-noise ratio |
|
| 122 |
+
| `phonemes` | string | Phoneme sequence |
|
| 123 |
+
| `task` | string | Task label |
|
| 124 |
+
|
| 125 |
+
**Eval-only columns**
|
| 126 |
+
|
| 127 |
+
| Column | Type | Description |
|
| 128 |
+
| ------ | ---- | ----------- |
|
| 129 |
+
| `speaker_idiosyncratic_style_instruction` | string | Instruction for speaker style caption |
|
| 130 |
+
| `situational_contextual_style_instruction` | string | Instruction for situational style |
|
| 131 |
+
| `expressive_emotional_style_instruction` | string | Instruction for expressive style |
|
| 132 |
+
| `linguistic_pragmatic_style_instruction` | string | Instruction for linguistic style |
|
| 133 |
+
| `perceptual_listener_centric_style_instruction` | string | Instruction for listener-centric style |
|
| 134 |
+
| `holistic_creative_synthesis_instruction` | string | Instruction for holistic synthesis |
|
| 135 |
+
|
| 136 |
+
### OODPrompts
|
| 137 |
+
|
| 138 |
+
| Split | Rows | Description |
|
| 139 |
+
| ----- | ---- | ----------- |
|
| 140 |
+
| `test` | 32 | VCTK OOD prompt evaluation (36 instruction prompts per utterance) |
|
| 141 |
+
|
| 142 |
+
**Core columns:** `source`, `relative_audio_path`, `speakerid`, `accent`, and `prompt1_speaker_idiosyncratic_style_instruction` through `prompt36_holistic_creative_synthesis_style_instruction`, covering speaker-idiosyncratic, situational, expressive, linguistic, perceptual, and holistic prompt families.
|
| 143 |
+
|
| 144 |
+
### MetaSet
|
| 145 |
+
|
| 146 |
+
| Split | Rows | Description |
|
| 147 |
+
| ----- | ---- | ----------- |
|
| 148 |
+
| `test` | 434 | Eval-500 benchmark subset with full style annotations and instructions |
|
| 149 |
+
|
| 150 |
+
Schema matches **StyleInstructCaps/eval** (all shared style caption fields plus the six `*_instruction` columns).
|
| 151 |
+
|
| 152 |
+
### IDBalanced
|
| 153 |
+
|
| 154 |
+
| Split | Rows | Description |
|
| 155 |
+
| ----- | ---- | ----------- |
|
| 156 |
+
| `test` | 400 | Accent/gender-balanced in-distribution evaluation set |
|
| 157 |
+
|
| 158 |
+
**Core columns:** `source`, `relative_audio_path`, `speakerid`, `accent`, `duration`, `snr`, and `prompt1_speaker_idiosyncratic_style_instruction` through `prompt10_speaker_idiosyncratic_style_instruction`.
|
| 159 |
+
|
| 160 |
+
### UDVCTK
|
| 161 |
+
|
| 162 |
+
| Split | Rows | Description |
|
| 163 |
+
| ----- | ---- | ----------- |
|
| 164 |
+
| `test` | 320 | VCTK evaluation with 10 speaker-idiosyncratic prompts |
|
| 165 |
+
|
| 166 |
+
**Core columns:** `source`, `relative_audio_path`, `speakerid`, `accent`, and `prompt1_speaker_idiosyncratic_style_instruction` through `prompt10_speaker_idiosyncratic_style_instruction`.
|
| 167 |
+
|
| 168 |
+
### UnseenEval
|
| 169 |
+
|
| 170 |
+
| Split | Rows | Description |
|
| 171 |
+
| ----- | ---- | ----------- |
|
| 172 |
+
| `test` | 600 | Unseen GigaSpeech-style evaluation set |
|
| 173 |
+
|
| 174 |
+
**Core columns**
|
| 175 |
+
|
| 176 |
+
| Column | Type | Description |
|
| 177 |
+
| ------ | ---- | ----------- |
|
| 178 |
+
| `source` | string | Upstream dataset identifier (`eval_giga`) |
|
| 179 |
+
| `relative_audio_path` | string | Relative path within the evaluation GigaSpeech subset |
|
| 180 |
+
| `ground_truth_caption` | string | Reference style caption |
|
| 181 |
+
| `holistic_creative_synthesis_instruction` | string | Instruction for holistic caption generation |
|
| 182 |
+
|
| 183 |
+
## Audio Sources
|
| 184 |
+
|
| 185 |
+
Map each row's `source` and `relative_audio_path` to the corresponding upstream corpus:
|
| 186 |
+
|
| 187 |
+
| `source` value | Upstream audio corpus |
|
| 188 |
+
| -------------- | --------------------- |
|
| 189 |
+
| `emilia` | [Emilia-Dataset (EN)](https://huggingface.co/datasets/amphion/Emilia-Dataset) |
|
| 190 |
+
| `voxceleb` | [VoxCeleb / VoxCeleb2](https://www.robots.ox.ac.uk/~vgg/data/voxceleb/) |
|
| 191 |
+
| `VCTK` | [VCTK Corpus](https://datashare.ed.ac.uk/handle/10283/2950) |
|
| 192 |
+
| `ears` | [EARS Dataset](https://github.com/facebookresearch/ears_dataset) |
|
| 193 |
+
| `expresso` | [Expresso](https://github.com/facebookresearch/textlesslib/tree/main/examples/expresso/dataset) |
|
| 194 |
+
| `eval_giga` | [GigaSpeech](https://huggingface.co/datasets/speechcolab/gigaspeech) (evaluation subset) |
|
| 195 |
+
|
| 196 |
+
## Preparing and Uploading (maintainers)
|
| 197 |
+
|
| 198 |
+
From the project root:
|
| 199 |
+
|
| 200 |
+
```bash
|
| 201 |
+
python -m venv .venv
|
| 202 |
+
source .venv/bin/activate
|
| 203 |
+
pip install -r release/scripts/requirements.txt
|
| 204 |
+
|
| 205 |
+
python release/scripts/prepare_release.py
|
| 206 |
+
|
| 207 |
+
# Edit release/README.md: replace <HF_ORG>/<DATASET_NAME> and citation
|
| 208 |
+
huggingface-cli login
|
| 209 |
+
python release/scripts/upload_to_hf.py --org <HF_ORG> --name <DATASET_NAME>
|
| 210 |
+
```
|
| 211 |
+
|
| 212 |
+
## Citation
|
| 213 |
+
|
| 214 |
+
```bibtex
|
| 215 |
+
@misc{styleinstructcaps2026,
|
| 216 |
+
title = {StyleInstructCaps: Style-Captioned Speech Annotations},
|
| 217 |
+
author = {<TODO: authors>},
|
| 218 |
+
year = {2026},
|
| 219 |
+
howpublished = {\url{https://huggingface.co/datasets/<HF_ORG>/<DATASET_NAME>}}
|
| 220 |
+
}
|
| 221 |
+
```
|
| 222 |
+
|
| 223 |
+
Replace `<HF_ORG>`, `<DATASET_NAME>`, and the citation fields before publishing.
|
data/IDBalanced/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d6d8d24c6970b562eb177ba4905cd032030eaf0b2702707cc0c6c1656113fde3
|
| 3 |
+
size 33858
|
data/MetaSet/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5c67ce2666730b1460853011b8671efd44f75fee9e6d406a87ee30c91db011de
|
| 3 |
+
size 420418
|
data/OODPrompts/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:89d7ba31b77cb4256a1ef5abe9557dcc9660e24ae5d1a440ebc386f97170e888
|
| 3 |
+
size 64000
|
data/StyleInstructCaps/eval-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:17afd13d2949a63b6acacc44442ee097ab7a74c25558fe6a945c24bb045c42ab
|
| 3 |
+
size 13078194
|
data/StyleInstructCaps/train-00000-of-00011.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:223c3dea5a5ece9b3cd1c7aef6f05914f8d05eca01a836c3e3c28734c94e36ee
|
| 3 |
+
size 86122391
|
data/StyleInstructCaps/train-00001-of-00011.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b0a92b0d069c329d9d73719bca9d408010cc874ba4b0d0df085e3e058679d4d6
|
| 3 |
+
size 86173266
|
data/StyleInstructCaps/train-00002-of-00011.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:829152601149795b140217a6d0afab9c4347d12172ee6d80989e1409dea5d0ae
|
| 3 |
+
size 86277608
|
data/StyleInstructCaps/train-00003-of-00011.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:779b61855a633524b87608b40cd70511b6dbc46948b1046ede3d8a9fd6175d37
|
| 3 |
+
size 86168178
|
data/StyleInstructCaps/train-00004-of-00011.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d027615e332bb0a50b8d3fe25fe5669ac5d3a49bf3ea549558cb48391bc2bdd9
|
| 3 |
+
size 86306501
|
data/StyleInstructCaps/train-00005-of-00011.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:efdd068f79f3e1e5ce401598a7404480a1613e942b8c3d33400a4054557640c7
|
| 3 |
+
size 86234437
|
data/StyleInstructCaps/train-00006-of-00011.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:01beff6135c363cfd0d8ee0ed1f006c69248b367d587d89020fc82292c33391a
|
| 3 |
+
size 86234391
|
data/StyleInstructCaps/train-00007-of-00011.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d900689869b88e8c4845bbcc52533a71980c4763ed9df60b98a0ede98932c40e
|
| 3 |
+
size 86278309
|
data/StyleInstructCaps/train-00008-of-00011.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d24f307fbfe2198075d8476e85753995ebe26b7ac4f4e3fff4c6b7eb98219c37
|
| 3 |
+
size 86151181
|
data/StyleInstructCaps/train-00009-of-00011.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e3953342fadd91f93ae732be6e6e223b0fcfacb24fba5f2071cb1718869308b9
|
| 3 |
+
size 86057880
|
data/StyleInstructCaps/train-00010-of-00011.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:55d1fd91917a1d13fd960fe3c447b432b2e37e6c2c1ea933b9a40d8ec26bfbf8
|
| 3 |
+
size 27398529
|
data/UDVCTK/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:278a9678269c1b5e3b2f5f5156b7c2e2dd74b07dfbfcaadfaef03c0df117df14
|
| 3 |
+
size 24630
|
data/UnseenEval/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0df07446eed592dac46f6d4f6be2fd503ad205d35e87edb8a15f8ddba370ff70
|
| 3 |
+
size 61270
|
hf_release_for_spkcap_6e6bb298.plan.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: HF release for spkcap
|
| 3 |
+
overview: Package the 7 source JSON manifests as a single Hugging Face dataset repo (CapSpeech-style) with 6 configs and parquet files under `/home/schand30/scratchbsisman/schand30/spkcap/release/`, drop local absolute `audio_path`s, and provide scripts to prepare and push the release without modifying any source files.
|
| 4 |
+
todos:
|
| 5 |
+
- id: scaffold
|
| 6 |
+
content: "Create release/ skeleton: scripts/, data/, requirements.txt, README.md placeholder"
|
| 7 |
+
status: pending
|
| 8 |
+
- id: prepare_script
|
| 9 |
+
content: Write release/scripts/prepare_release.py that converts the 7 JSONs into parquet shards under release/data/<config>/, dropping local audio_path
|
| 10 |
+
status: pending
|
| 11 |
+
- id: readme
|
| 12 |
+
content: Write release/README.md with the configs YAML front-matter and CapSpeech-style body (overview, usage, per-config schemas, audio source mapping)
|
| 13 |
+
status: pending
|
| 14 |
+
- id: upload_script
|
| 15 |
+
content: Write release/scripts/upload_to_hf.py wrapper around huggingface_hub.upload_large_folder, parameterized by org/name
|
| 16 |
+
status: pending
|
| 17 |
+
- id: user_run
|
| 18 |
+
content: User installs deps, runs prepare_release.py, fills in repo name, runs upload_to_hf.py
|
| 19 |
+
status: pending
|
| 20 |
+
isProject: false
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## Goal
|
| 24 |
+
|
| 25 |
+
Release the seven manifests as a HF dataset repo modeled on [`OpenSound/CapSpeech`](https://huggingface.co/datasets/OpenSound/CapSpeech): one repo, multiple configs, parquet shards, metadata-only (no audio), with a placeholder repo name (`<HF_ORG>/<DATASET_NAME>`) the user fills in before pushing.
|
| 26 |
+
|
| 27 |
+
All work happens under `/home/schand30/scratchbsisman/schand30/spkcap/release/`. Source files in `data/data/` and `data/evaluation/data_input_dir/` are read-only.
|
| 28 |
+
|
| 29 |
+
## Config / split layout
|
| 30 |
+
|
| 31 |
+
Each source JSON has an `{"annotation": [...]}` wrapper with heterogeneous per-file schemas, so we use one HF "config" per logical dataset (this is what enables HF's split selector UI like CapSpeech's).
|
| 32 |
+
|
| 33 |
+
- `StyleInstructCaps`
|
| 34 |
+
- `train` <- `data/data/train_fullscale_with_desc_v2.json` (1,031,840 rows, 3.3 GB)
|
| 35 |
+
- `eval` <- `data/data/evaluation_holdout_with_desc_llama.json` (14,756 rows)
|
| 36 |
+
- `OODPrompts`
|
| 37 |
+
- `test` <- `data/evaluation/data_input_dir/vctk_manifest_2utt_36prompts_unseen.json` (32 rows)
|
| 38 |
+
- `Eval500`
|
| 39 |
+
- `test` <- `data/evaluation/data_input_dir/tbd1_500_llama_global.json` (434 rows)
|
| 40 |
+
- `IDBalanced`
|
| 41 |
+
- `test` <- `data/evaluation/data_input_dir/balance_acccent_gender_eval_set2_with_fields.json` (400 rows)
|
| 42 |
+
- `UDVCTK`
|
| 43 |
+
- `test` <- `data/evaluation/data_input_dir/vctk_manifest_10prompts.json` (320 rows)
|
| 44 |
+
- `UnseenEval`
|
| 45 |
+
- `test` <- `data/evaluation/data_input_dir/giga_manifest.json` (600 rows)
|
| 46 |
+
|
| 47 |
+
Each row keeps all original fields except the local absolute `audio_path` (dropped). `relative_audio_path` is preserved as the portable identifier; the README documents which upstream dataset each `source` value maps to.
|
| 48 |
+
|
| 49 |
+
## Output layout under `release/`
|
| 50 |
+
|
| 51 |
+
```text
|
| 52 |
+
release/
|
| 53 |
+
├── README.md # dataset card with YAML front-matter declaring configs
|
| 54 |
+
├── scripts/
|
| 55 |
+
│ ├── requirements.txt # huggingface_hub, datasets, pyarrow, tqdm
|
| 56 |
+
│ ├── prepare_release.py # JSON -> parquet under release/data/<config>/
|
| 57 |
+
│ └── upload_to_hf.py # pushes release/ to <HF_ORG>/<DATASET_NAME>
|
| 58 |
+
└── data/
|
| 59 |
+
├── StyleInstructCaps/
|
| 60 |
+
│ ├── train-00000-of-000NN.parquet # ~100k rows per shard => ~11 shards
|
| 61 |
+
│ └── eval-00000-of-00001.parquet
|
| 62 |
+
├── OODPrompts/test-00000-of-00001.parquet
|
| 63 |
+
├── Eval500/test-00000-of-00001.parquet
|
| 64 |
+
├── IDBalanced/test-00000-of-00001.parquet
|
| 65 |
+
├── UDVCTK/test-00000-of-00001.parquet
|
| 66 |
+
└── UnseenEval/test-00000-of-00001.parquet
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
## README.md front-matter (mirrors CapSpeech "data files via YAML" pattern)
|
| 70 |
+
|
| 71 |
+
```yaml
|
| 72 |
+
---
|
| 73 |
+
license: cc-by-nc-4.0
|
| 74 |
+
language:
|
| 75 |
+
- en
|
| 76 |
+
task_categories:
|
| 77 |
+
- text-to-speech
|
| 78 |
+
configs:
|
| 79 |
+
- config_name: StyleInstructCaps
|
| 80 |
+
data_files:
|
| 81 |
+
- split: train
|
| 82 |
+
path: data/StyleInstructCaps/train-*.parquet
|
| 83 |
+
- split: eval
|
| 84 |
+
path: data/StyleInstructCaps/eval-*.parquet
|
| 85 |
+
- config_name: OODPrompts
|
| 86 |
+
data_files:
|
| 87 |
+
- split: test
|
| 88 |
+
path: data/OODPrompts/test-*.parquet
|
| 89 |
+
- config_name: Eval500
|
| 90 |
+
data_files:
|
| 91 |
+
- split: test
|
| 92 |
+
path: data/Eval500/test-*.parquet
|
| 93 |
+
- config_name: IDBalanced
|
| 94 |
+
data_files:
|
| 95 |
+
- split: test
|
| 96 |
+
path: data/IDBalanced/test-*.parquet
|
| 97 |
+
- config_name: UDVCTK
|
| 98 |
+
data_files:
|
| 99 |
+
- split: test
|
| 100 |
+
path: data/UDVCTK/test-*.parquet
|
| 101 |
+
- config_name: UnseenEval
|
| 102 |
+
data_files:
|
| 103 |
+
- split: test
|
| 104 |
+
path: data/UnseenEval/test-*.parquet
|
| 105 |
+
---
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
The README body mirrors CapSpeech's structure: Overview, License (CC BY-NC 4.0 placeholder), Usage snippet (`load_dataset("<HF_ORG>/<DATASET_NAME>", "StyleInstructCaps", split="train")`), per-config Schema tables, Audio Sources table mapping each `source` value (`emilia`, `voxceleb`, `VCTK`, `ears`, `eval_giga`) to its upstream dataset URL, and a Citation block with `<TODO citation>`.
|
| 109 |
+
|
| 110 |
+
## `prepare_release.py` behavior
|
| 111 |
+
|
| 112 |
+
Single, idempotent script that:
|
| 113 |
+
|
| 114 |
+
1. Loads each source JSON via `json.load(...)["annotation"]`. Train file (3.3 GB) needs ~10-12 GB RAM at peak; the script logs a warning and recommends running on a node with >=16 GB free RAM. (If that's a concern we can swap to `ijson` streaming, but starts simpler.)
|
| 115 |
+
2. Drops the `audio_path` key from every record (keeps `relative_audio_path`).
|
| 116 |
+
3. Builds a `datasets.Dataset` per file (preserves nested lists/nullable fields like `situational_tags`).
|
| 117 |
+
4. Writes parquet to the layout above. For `StyleInstructCaps/train`, shards via `Dataset.shard(num_shards=ceil(N/100_000), index=i).to_parquet(...)` so each shard is roughly 100k rows / a few hundred MB. All other splits write a single `*-00000-of-00001.parquet`.
|
| 118 |
+
5. Prints final row counts to verify against the source counts (`1031840 / 14756 / 32 / 434 / 400 / 320 / 600`).
|
| 119 |
+
|
| 120 |
+
## `upload_to_hf.py` behavior
|
| 121 |
+
|
| 122 |
+
Thin wrapper around `huggingface_hub.HfApi`:
|
| 123 |
+
|
| 124 |
+
- Reads `HF_ORG` and `DATASET_NAME` from CLI args (or env).
|
| 125 |
+
- `create_repo(repo_id=f"{HF_ORG}/{DATASET_NAME}", repo_type="dataset", exist_ok=True)`.
|
| 126 |
+
- `upload_large_folder(folder_path="release/", repo_id=..., repo_type="dataset", ignore_patterns=["scripts/__pycache__/*"])`.
|
| 127 |
+
- Prints the resulting URL.
|
| 128 |
+
|
| 129 |
+
## Step-by-step the user runs
|
| 130 |
+
|
| 131 |
+
1. Create venv and install deps
|
| 132 |
+
- `python -m venv .venv && source .venv/bin/activate`
|
| 133 |
+
- `pip install -r release/scripts/requirements.txt`
|
| 134 |
+
2. Generate the release artifacts
|
| 135 |
+
- `python release/scripts/prepare_release.py`
|
| 136 |
+
- Verify `release/data/...` shape and row counts in stdout.
|
| 137 |
+
3. Edit `release/README.md`: fill in `<HF_ORG>/<DATASET_NAME>`, citation, license confirmation, and any per-config notes.
|
| 138 |
+
4. Authenticate with HF: `huggingface-cli login` (paste a write-scoped token).
|
| 139 |
+
5. Push:
|
| 140 |
+
- `python release/scripts/upload_to_hf.py --org <HF_ORG> --name <DATASET_NAME>`
|
| 141 |
+
- Or equivalently: `huggingface-cli upload <HF_ORG>/<DATASET_NAME> release/ . --repo-type=dataset`.
|
| 142 |
+
6. On the HF dataset page, confirm the config/split selector shows all 7 splits and that the data viewer renders rows.
|
| 143 |
+
|
| 144 |
+
## Things explicitly NOT done
|
| 145 |
+
|
| 146 |
+
- No edits to any source JSON in `data/data/` or `data/evaluation/data_input_dir/`.
|
| 147 |
+
- No upload of audio files; users are pointed at upstream datasets for the audio.
|
| 148 |
+
- Repo name kept as a placeholder until the user provides it.
|
scripts/prepare_release.py
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Convert source JSON manifests into Hugging Face release parquet files.
|
| 3 |
+
|
| 4 |
+
Reads source files under data/ (read-only), drops local absolute audio_path,
|
| 5 |
+
and writes parquet shards under release/data/<config>/.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
from __future__ import annotations
|
| 9 |
+
|
| 10 |
+
import argparse
|
| 11 |
+
import json
|
| 12 |
+
import sys
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
from typing import Any, Iterator
|
| 15 |
+
|
| 16 |
+
import ijson
|
| 17 |
+
from datasets import Dataset
|
| 18 |
+
from tqdm import tqdm
|
| 19 |
+
|
| 20 |
+
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
| 21 |
+
RELEASE_ROOT = PROJECT_ROOT / "release"
|
| 22 |
+
DATA_ROOT = RELEASE_ROOT / "data"
|
| 23 |
+
|
| 24 |
+
ROWS_PER_SHARD = 100_000
|
| 25 |
+
|
| 26 |
+
# Expected row counts for verification.
|
| 27 |
+
EXPECTED_COUNTS = {
|
| 28 |
+
("StyleInstructCaps", "train"): 1_031_840,
|
| 29 |
+
("StyleInstructCaps", "eval"): 14_756,
|
| 30 |
+
("OODPrompts", "test"): 32,
|
| 31 |
+
("MetaSet", "test"): 434,
|
| 32 |
+
("IDBalanced", "test"): 400,
|
| 33 |
+
("UDVCTK", "test"): 320,
|
| 34 |
+
("UnseenEval", "test"): 600,
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
RELEASE_SPECS: list[dict[str, Any]] = [
|
| 38 |
+
{
|
| 39 |
+
"config": "StyleInstructCaps",
|
| 40 |
+
"split": "train",
|
| 41 |
+
"source": PROJECT_ROOT / "data/data/train_fullscale_with_desc_v2.json",
|
| 42 |
+
"stream": True,
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"config": "StyleInstructCaps",
|
| 46 |
+
"split": "eval",
|
| 47 |
+
"source": PROJECT_ROOT / "data/data/evaluation_holdout_with_desc_llama.json",
|
| 48 |
+
"stream": False,
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"config": "OODPrompts",
|
| 52 |
+
"split": "test",
|
| 53 |
+
"source": PROJECT_ROOT
|
| 54 |
+
/ "data/evaluation/data_input_dir/vctk_manifest_2utt_36prompts_unseen.json",
|
| 55 |
+
"stream": False,
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"config": "MetaSet",
|
| 59 |
+
"split": "test",
|
| 60 |
+
"source": PROJECT_ROOT
|
| 61 |
+
/ "data/evaluation/data_input_dir/tbd1_500_llama_global.json",
|
| 62 |
+
"stream": False,
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"config": "IDBalanced",
|
| 66 |
+
"split": "test",
|
| 67 |
+
"source": PROJECT_ROOT
|
| 68 |
+
/ "data/evaluation/data_input_dir/balance_acccent_gender_eval_set2_with_fields.json",
|
| 69 |
+
"stream": False,
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"config": "UDVCTK",
|
| 73 |
+
"split": "test",
|
| 74 |
+
"source": PROJECT_ROOT
|
| 75 |
+
/ "data/evaluation/data_input_dir/vctk_manifest_10prompts.json",
|
| 76 |
+
"stream": False,
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"config": "UnseenEval",
|
| 80 |
+
"split": "test",
|
| 81 |
+
"source": PROJECT_ROOT
|
| 82 |
+
/ "data/evaluation/data_input_dir/giga_manifest.json",
|
| 83 |
+
"stream": False,
|
| 84 |
+
},
|
| 85 |
+
]
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
STYLE_TEXT_FIELDS = {
|
| 89 |
+
"speaker_idiosyncratic_style",
|
| 90 |
+
"situational_contextual_style",
|
| 91 |
+
"expressive_emotional_style",
|
| 92 |
+
"linguistic_pragmatic_style",
|
| 93 |
+
"perceptual_listener_centric_style",
|
| 94 |
+
"holistic_creative_synthesis",
|
| 95 |
+
"captions",
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
LIST_FIELDS = {
|
| 99 |
+
"text_description",
|
| 100 |
+
"intrinsic_tags",
|
| 101 |
+
"situational_tags",
|
| 102 |
+
"basic_tags",
|
| 103 |
+
"all_tags",
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def _to_text(value: Any) -> str | None:
|
| 108 |
+
if value is None:
|
| 109 |
+
return None
|
| 110 |
+
if isinstance(value, str):
|
| 111 |
+
return value
|
| 112 |
+
if isinstance(value, list):
|
| 113 |
+
parts = [str(item) for item in value if item is not None]
|
| 114 |
+
return " ".join(parts) if parts else None
|
| 115 |
+
return str(value)
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def _to_string_list(value: Any) -> list[str]:
|
| 119 |
+
if value is None:
|
| 120 |
+
return []
|
| 121 |
+
if isinstance(value, str):
|
| 122 |
+
return [value]
|
| 123 |
+
if isinstance(value, list):
|
| 124 |
+
return [str(item) for item in value if item is not None]
|
| 125 |
+
return [str(value)]
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
FLOAT_FIELDS = {
|
| 129 |
+
"duration",
|
| 130 |
+
"snr",
|
| 131 |
+
"utterance_pitch_mean",
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
def _to_float(value: Any) -> float | None:
|
| 136 |
+
if value is None:
|
| 137 |
+
return None
|
| 138 |
+
return float(value)
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def normalize_record(record: dict[str, Any]) -> dict[str, Any]:
|
| 142 |
+
"""Normalize heterogeneous JSON values to parquet-friendly types."""
|
| 143 |
+
cleaned = dict(record)
|
| 144 |
+
cleaned.pop("audio_path", None)
|
| 145 |
+
|
| 146 |
+
for field in STYLE_TEXT_FIELDS:
|
| 147 |
+
if field in cleaned:
|
| 148 |
+
cleaned[field] = _to_text(cleaned[field])
|
| 149 |
+
|
| 150 |
+
for field in LIST_FIELDS:
|
| 151 |
+
if field in cleaned:
|
| 152 |
+
cleaned[field] = _to_string_list(cleaned[field])
|
| 153 |
+
|
| 154 |
+
if "accent" in cleaned and cleaned["accent"] is None:
|
| 155 |
+
cleaned["accent"] = ""
|
| 156 |
+
|
| 157 |
+
for field in FLOAT_FIELDS:
|
| 158 |
+
if field in cleaned:
|
| 159 |
+
cleaned[field] = _to_float(cleaned[field])
|
| 160 |
+
|
| 161 |
+
return cleaned
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def sanitize_record(record: dict[str, Any]) -> dict[str, Any]:
|
| 165 |
+
"""Drop local absolute audio_path and normalize field types."""
|
| 166 |
+
return normalize_record(record)
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
def iter_annotation_records(source_path: Path) -> Iterator[dict[str, Any]]:
|
| 170 |
+
"""Stream records from a large JSON file with an annotation array."""
|
| 171 |
+
with source_path.open("rb") as handle:
|
| 172 |
+
for record in ijson.items(handle, "annotation.item"):
|
| 173 |
+
yield sanitize_record(record)
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
def load_annotation_records(source_path: Path) -> list[dict[str, Any]]:
|
| 177 |
+
with source_path.open("r", encoding="utf-8") as handle:
|
| 178 |
+
payload = json.load(handle)
|
| 179 |
+
records = payload["annotation"]
|
| 180 |
+
return [sanitize_record(record) for record in records]
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def write_single_parquet(
|
| 184 |
+
records: list[dict[str, Any]],
|
| 185 |
+
output_dir: Path,
|
| 186 |
+
split: str,
|
| 187 |
+
) -> int:
|
| 188 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 189 |
+
dataset = Dataset.from_list(records)
|
| 190 |
+
output_path = output_dir / f"{split}-00000-of-00001.parquet"
|
| 191 |
+
dataset.to_parquet(str(output_path))
|
| 192 |
+
return len(records)
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
def write_sharded_parquet(
|
| 196 |
+
record_iter: Iterator[dict[str, Any]],
|
| 197 |
+
output_dir: Path,
|
| 198 |
+
split: str,
|
| 199 |
+
rows_per_shard: int,
|
| 200 |
+
) -> int:
|
| 201 |
+
"""Write parquet shards from a streaming iterator."""
|
| 202 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 203 |
+
|
| 204 |
+
total_rows = 0
|
| 205 |
+
shard_rows: list[dict[str, Any]] = []
|
| 206 |
+
shard_paths: list[Path] = []
|
| 207 |
+
|
| 208 |
+
def flush_shard(rows: list[dict[str, Any]], index: int) -> None:
|
| 209 |
+
if not rows:
|
| 210 |
+
return
|
| 211 |
+
path = output_dir / f"{split}-shard-{index:05d}.parquet"
|
| 212 |
+
Dataset.from_list(rows).to_parquet(str(path))
|
| 213 |
+
shard_paths.append(path)
|
| 214 |
+
|
| 215 |
+
for record in tqdm(record_iter, desc=f"{output_dir.name}/{split}", unit="rows"):
|
| 216 |
+
shard_rows.append(record)
|
| 217 |
+
total_rows += 1
|
| 218 |
+
if len(shard_rows) >= rows_per_shard:
|
| 219 |
+
flush_shard(shard_rows, len(shard_paths))
|
| 220 |
+
shard_rows = []
|
| 221 |
+
|
| 222 |
+
if shard_rows:
|
| 223 |
+
flush_shard(shard_rows, len(shard_paths))
|
| 224 |
+
|
| 225 |
+
total_shards = len(shard_paths)
|
| 226 |
+
for index, shard_path in enumerate(shard_paths):
|
| 227 |
+
final_name = output_dir / f"{split}-{index:05d}-of-{total_shards:05d}.parquet"
|
| 228 |
+
shard_path.rename(final_name)
|
| 229 |
+
|
| 230 |
+
return total_rows
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
def process_spec(spec: dict[str, Any], rows_per_shard: int) -> tuple[str, str, int]:
|
| 234 |
+
config = spec["config"]
|
| 235 |
+
split = spec["split"]
|
| 236 |
+
source: Path = spec["source"]
|
| 237 |
+
output_dir = DATA_ROOT / config
|
| 238 |
+
|
| 239 |
+
if not source.exists():
|
| 240 |
+
raise FileNotFoundError(f"Missing source file: {source}")
|
| 241 |
+
|
| 242 |
+
print(f"\nProcessing {config}/{split} from {source}")
|
| 243 |
+
|
| 244 |
+
if spec.get("stream"):
|
| 245 |
+
print(
|
| 246 |
+
" Streaming large file with ijson (~3.3 GB JSON). "
|
| 247 |
+
"Recommend >=16 GB free RAM for parquet conversion."
|
| 248 |
+
)
|
| 249 |
+
row_count = write_sharded_parquet(
|
| 250 |
+
iter_annotation_records(source),
|
| 251 |
+
output_dir=output_dir,
|
| 252 |
+
split=split,
|
| 253 |
+
rows_per_shard=rows_per_shard,
|
| 254 |
+
)
|
| 255 |
+
else:
|
| 256 |
+
records = load_annotation_records(source)
|
| 257 |
+
row_count = write_single_parquet(records, output_dir=output_dir, split=split)
|
| 258 |
+
|
| 259 |
+
expected = EXPECTED_COUNTS.get((config, split))
|
| 260 |
+
if expected is not None and row_count != expected:
|
| 261 |
+
print(
|
| 262 |
+
f" WARNING: row count mismatch for {config}/{split}: "
|
| 263 |
+
f"got {row_count}, expected {expected}",
|
| 264 |
+
file=sys.stderr,
|
| 265 |
+
)
|
| 266 |
+
else:
|
| 267 |
+
print(f" Wrote {row_count} rows to {output_dir}")
|
| 268 |
+
|
| 269 |
+
return config, split, row_count
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
def main() -> None:
|
| 273 |
+
parser = argparse.ArgumentParser(description="Prepare Hugging Face release parquet files.")
|
| 274 |
+
parser.add_argument(
|
| 275 |
+
"--rows-per-shard",
|
| 276 |
+
type=int,
|
| 277 |
+
default=ROWS_PER_SHARD,
|
| 278 |
+
help="Rows per parquet shard for the large train split.",
|
| 279 |
+
)
|
| 280 |
+
args = parser.parse_args()
|
| 281 |
+
|
| 282 |
+
print(f"Project root: {PROJECT_ROOT}")
|
| 283 |
+
print(f"Release data dir: {DATA_ROOT}")
|
| 284 |
+
|
| 285 |
+
summary: list[tuple[str, str, int]] = []
|
| 286 |
+
for spec in RELEASE_SPECS:
|
| 287 |
+
summary.append(process_spec(spec, rows_per_shard=args.rows_per_shard))
|
| 288 |
+
|
| 289 |
+
print("\nSummary:")
|
| 290 |
+
for config, split, count in summary:
|
| 291 |
+
print(f" {config}/{split}: {count:,} rows")
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
if __name__ == "__main__":
|
| 295 |
+
main()
|
scripts/requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
huggingface_hub>=0.26.0
|
| 2 |
+
datasets>=3.0.0
|
| 3 |
+
fsspec[http]>=2023.1.0,<=2024.9.0
|
| 4 |
+
pyarrow>=17.0.0
|
| 5 |
+
tqdm>=4.66.0
|
| 6 |
+
ijson>=3.3.0
|
scripts/upload_to_hf.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Upload the prepared release folder to Hugging Face Hub."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import argparse
|
| 7 |
+
import os
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
|
| 10 |
+
from huggingface_hub import HfApi
|
| 11 |
+
|
| 12 |
+
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
| 13 |
+
RELEASE_ROOT = PROJECT_ROOT / "release"
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def parse_args() -> argparse.Namespace:
|
| 17 |
+
parser = argparse.ArgumentParser(description="Upload release/ to Hugging Face Hub.")
|
| 18 |
+
parser.add_argument(
|
| 19 |
+
"--org",
|
| 20 |
+
default=os.environ.get("HF_ORG"),
|
| 21 |
+
help="Hugging Face organization or username (or set HF_ORG).",
|
| 22 |
+
)
|
| 23 |
+
parser.add_argument(
|
| 24 |
+
"--name",
|
| 25 |
+
default=os.environ.get("DATASET_NAME"),
|
| 26 |
+
help="Dataset repository name (or set DATASET_NAME).",
|
| 27 |
+
)
|
| 28 |
+
parser.add_argument(
|
| 29 |
+
"--release-dir",
|
| 30 |
+
type=Path,
|
| 31 |
+
default=RELEASE_ROOT,
|
| 32 |
+
help="Path to the release directory to upload.",
|
| 33 |
+
)
|
| 34 |
+
return parser.parse_args()
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def main() -> None:
|
| 38 |
+
args = parse_args()
|
| 39 |
+
if not args.org or not args.name:
|
| 40 |
+
raise SystemExit(
|
| 41 |
+
"Missing repo identifiers. Provide --org and --name, "
|
| 42 |
+
"or set HF_ORG and DATASET_NAME environment variables."
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
release_dir = args.release_dir.resolve()
|
| 46 |
+
if not release_dir.exists():
|
| 47 |
+
raise SystemExit(f"Release directory not found: {release_dir}")
|
| 48 |
+
|
| 49 |
+
repo_id = f"{args.org}/{args.name}"
|
| 50 |
+
api = HfApi()
|
| 51 |
+
|
| 52 |
+
print(f"Creating dataset repo (if needed): {repo_id}")
|
| 53 |
+
api.create_repo(repo_id=repo_id, repo_type="dataset", exist_ok=True)
|
| 54 |
+
|
| 55 |
+
print(f"Uploading {release_dir} -> {repo_id}")
|
| 56 |
+
api.upload_large_folder(
|
| 57 |
+
folder_path=str(release_dir),
|
| 58 |
+
repo_id=repo_id,
|
| 59 |
+
repo_type="dataset",
|
| 60 |
+
ignore_patterns=["scripts/__pycache__/*", "**/.venv/**", "**/__pycache__/**"],
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
print(f"Upload complete: https://huggingface.co/datasets/{repo_id}")
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
if __name__ == "__main__":
|
| 67 |
+
main()
|