Datasets:
File size: 910 Bytes
93710b8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 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}")
|