File size: 512 Bytes
981bcde
 
 
 
 
 
fab94a8
 
981bcde
b396397
fab94a8
 
981bcde
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import json
import warnings
warnings.filterwarnings('ignore')

from os.path import exists
import librosa
from datasets import load_dataset

ds = load_dataset("Yehor/tts-mykyta-uk", "tetiana")
files_dir = '/home/yehor/ext-ml-disk/tts/tts-mykyta-uk/files/tetiana/dataset_tetiana/accept'

for row in ds['train']:
    filename = f'{files_dir}/{row["audio"]}'
    if not exists(filename):
        continue

    duration = librosa.get_duration(path=filename)
    row['duration'] = duration

    print(json.dumps(row))