StyleInstructCapsDB / hf_release_for_spkcap_6e6bb298.plan.md
StyleInstructCaps's picture
Add files using upload-large-folder tool
563ce83 verified
|
Raw History Blame Contribute Delete
7.33 kB
---
name: HF release for spkcap
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.
todos:
- id: scaffold
content: "Create release/ skeleton: scripts/, data/, requirements.txt, README.md placeholder"
status: pending
- id: prepare_script
content: Write release/scripts/prepare_release.py that converts the 7 JSONs into parquet shards under release/data/<config>/, dropping local audio_path
status: pending
- id: readme
content: Write release/README.md with the configs YAML front-matter and CapSpeech-style body (overview, usage, per-config schemas, audio source mapping)
status: pending
- id: upload_script
content: Write release/scripts/upload_to_hf.py wrapper around huggingface_hub.upload_large_folder, parameterized by org/name
status: pending
- id: user_run
content: User installs deps, runs prepare_release.py, fills in repo name, runs upload_to_hf.py
status: pending
isProject: false
---
## Goal
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.
All work happens under `/home/schand30/scratchbsisman/schand30/spkcap/release/`. Source files in `data/data/` and `data/evaluation/data_input_dir/` are read-only.
## Config / split layout
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).
- `StyleInstructCaps`
- `train` <- `data/data/train_fullscale_with_desc_v2.json` (1,031,840 rows, 3.3 GB)
- `eval` <- `data/data/evaluation_holdout_with_desc_llama.json` (14,756 rows)
- `OODPrompts`
- `test` <- `data/evaluation/data_input_dir/vctk_manifest_2utt_36prompts_unseen.json` (32 rows)
- `Eval500`
- `test` <- `data/evaluation/data_input_dir/tbd1_500_llama_global.json` (434 rows)
- `IDBalanced`
- `test` <- `data/evaluation/data_input_dir/balance_acccent_gender_eval_set2_with_fields.json` (400 rows)
- `UDVCTK`
- `test` <- `data/evaluation/data_input_dir/vctk_manifest_10prompts.json` (320 rows)
- `UnseenEval`
- `test` <- `data/evaluation/data_input_dir/giga_manifest.json` (600 rows)
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.
## Output layout under `release/`
```text
release/
├── README.md # dataset card with YAML front-matter declaring configs
├── scripts/
│ ├── requirements.txt # huggingface_hub, datasets, pyarrow, tqdm
│ ├── prepare_release.py # JSON -> parquet under release/data/<config>/
│ └── upload_to_hf.py # pushes release/ to <HF_ORG>/<DATASET_NAME>
└── data/
├── StyleInstructCaps/
│ ├── train-00000-of-000NN.parquet # ~100k rows per shard => ~11 shards
│ └── eval-00000-of-00001.parquet
├── OODPrompts/test-00000-of-00001.parquet
├── Eval500/test-00000-of-00001.parquet
├── IDBalanced/test-00000-of-00001.parquet
├── UDVCTK/test-00000-of-00001.parquet
└── UnseenEval/test-00000-of-00001.parquet
```
## README.md front-matter (mirrors CapSpeech "data files via YAML" pattern)
```yaml
---
license: cc-by-nc-4.0
language:
- en
task_categories:
- text-to-speech
configs:
- config_name: StyleInstructCaps
data_files:
- split: train
path: data/StyleInstructCaps/train-*.parquet
- split: eval
path: data/StyleInstructCaps/eval-*.parquet
- config_name: OODPrompts
data_files:
- split: test
path: data/OODPrompts/test-*.parquet
- config_name: Eval500
data_files:
- split: test
path: data/Eval500/test-*.parquet
- config_name: IDBalanced
data_files:
- split: test
path: data/IDBalanced/test-*.parquet
- config_name: UDVCTK
data_files:
- split: test
path: data/UDVCTK/test-*.parquet
- config_name: UnseenEval
data_files:
- split: test
path: data/UnseenEval/test-*.parquet
---
```
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>`.
## `prepare_release.py` behavior
Single, idempotent script that:
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.)
2. Drops the `audio_path` key from every record (keeps `relative_audio_path`).
3. Builds a `datasets.Dataset` per file (preserves nested lists/nullable fields like `situational_tags`).
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`.
5. Prints final row counts to verify against the source counts (`1031840 / 14756 / 32 / 434 / 400 / 320 / 600`).
## `upload_to_hf.py` behavior
Thin wrapper around `huggingface_hub.HfApi`:
- Reads `HF_ORG` and `DATASET_NAME` from CLI args (or env).
- `create_repo(repo_id=f"{HF_ORG}/{DATASET_NAME}", repo_type="dataset", exist_ok=True)`.
- `upload_large_folder(folder_path="release/", repo_id=..., repo_type="dataset", ignore_patterns=["scripts/__pycache__/*"])`.
- Prints the resulting URL.
## Step-by-step the user runs
1. Create venv and install deps
- `python -m venv .venv && source .venv/bin/activate`
- `pip install -r release/scripts/requirements.txt`
2. Generate the release artifacts
- `python release/scripts/prepare_release.py`
- Verify `release/data/...` shape and row counts in stdout.
3. Edit `release/README.md`: fill in `<HF_ORG>/<DATASET_NAME>`, citation, license confirmation, and any per-config notes.
4. Authenticate with HF: `huggingface-cli login` (paste a write-scoped token).
5. Push:
- `python release/scripts/upload_to_hf.py --org <HF_ORG> --name <DATASET_NAME>`
- Or equivalently: `huggingface-cli upload <HF_ORG>/<DATASET_NAME> release/ . --repo-type=dataset`.
6. On the HF dataset page, confirm the config/split selector shows all 7 splits and that the data viewer renders rows.
## Things explicitly NOT done
- No edits to any source JSON in `data/data/` or `data/evaluation/data_input_dir/`.
- No upload of audio files; users are pointed at upstream datasets for the audio.
- Repo name kept as a placeholder until the user provides it.