Datasets:
Download load_data_tts.py from lab260/mos260: direct link, hf CLI and curl.
- Browser
- Download file 910 Bytes
-
https://huggingface.co/datasets/lab260/mos260/resolve/main/load_data_tts.py
- Command line
-
hf download hf://datasets/lab260/mos260/load_data_tts.py
-
curl -L -o load_data_tts.py https://huggingface.co/datasets/lab260/mos260/resolve/main/load_data_tts.py
910 Bytes
| from datasets import load_dataset | |
| import soundfile as sf | |
| from pathlib import Path | |
| import pandas as pd | |
| from tqdm import tqdm | |
| outdir = Path("OUT_DIR_PATH") | |
| outdir.mkdir(parents=True, exist_ok=True) | |
| dataset = load_dataset("MTUCI/TTS_MOS_Evaluation_Dataset", split="train") | |
| mos_records = [] | |
| for item in tqdm(dataset, desc="Сохраняем аудио"): | |
| safe_name = item['filename'].replace('/', '_').replace('\\', '_') | |
| out_path = outdir / safe_name | |
| out_path.write_bytes(item['audio']) | |
| mos_records.append({ | |
| "inner_audio_id": item["inner_audio_id"], | |
| "file_name": str(out_path), | |
| "mos": item['int_mos_mean'] if pd.notna(item['int_mos_mean']) else item['mos_mean'] | |
| }) | |
| csv_path = "CVS_PATH" | |
| pd.DataFrame(mos_records).to_csv(csv_path, index=False) | |
| print(f"Готово! Всего {len(mos_records)} аудио. MOS метки сохранены в {csv_path}") | |