possible logic optimization so I don't spend another 15 minutes simply iterating back to the point I was at in vall_e.emb.process
This commit is contained in:
parent
0dc49ef4d5
commit
8f86cf0e4e
|
@ -322,13 +322,12 @@ def process(
|
||||||
if len(text) == 0 or outpath.exists():
|
if len(text) == 0 or outpath.exists():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# audio not already loaded, load it
|
if max_duration:
|
||||||
if waveform is None:
|
info = torchaudio.info( inpath )
|
||||||
waveform, sample_rate = load_audio( inpath, dtype=dtype )
|
if info.num_frames / info.sample_rate > max_duration:
|
||||||
|
continue
|
||||||
if max_duration and waveform.shape[-1] / sample_rate > max_duration:
|
|
||||||
continue
|
|
||||||
|
|
||||||
|
waveform, sample_rate = load_audio( inpath, dtype=dtype )
|
||||||
jobs.append(( outpath, waveform, sample_rate, text, language ))
|
jobs.append(( outpath, waveform, sample_rate, text, language ))
|
||||||
else:
|
else:
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -351,15 +350,18 @@ def process(
|
||||||
if len(text) == 0 or outpath.exists():
|
if len(text) == 0 or outpath.exists():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
start = (segment['start']-0.05)
|
||||||
|
end = (segment['end']+0.5)
|
||||||
|
|
||||||
|
if max_duration and end - start > max_duration:
|
||||||
|
continue
|
||||||
|
|
||||||
# audio not already loaded, load it
|
# audio not already loaded, load it
|
||||||
if waveform is None:
|
if waveform is None:
|
||||||
waveform, sample_rate = load_audio( inpath, dtype=dtype )
|
waveform, sample_rate = load_audio( inpath, dtype=dtype )
|
||||||
|
|
||||||
start = int((segment['start']-0.05) * sample_rate)
|
start = int(start * sample_rate)
|
||||||
end = int((segment['end']+0.5) * sample_rate)
|
end = int(end * sample_rate)
|
||||||
|
|
||||||
if max_duration and (end - start) / sample_rate > max_duration:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if not presliced:
|
if not presliced:
|
||||||
if start < 0:
|
if start < 0:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user