ecker commited on
Commit
cf41492
·
1 Parent(s): b90c164

fall back to normal behavior if theres actually no audiofiles loaded from the dataset when using it for computing latents

Browse files
Files changed (1) hide show
  1. src/utils.py +4 -1
src/utils.py CHANGED
@@ -543,7 +543,7 @@ def compute_latents(voice=None, voice_samples=None, voice_latents_chunks=0, prog
543
  with open(dataset_path, 'r', encoding="utf-8") as f:
544
  lines = f.readlines()
545
 
546
- print("Leveraging LJSpeech dataset for computing latents")
547
 
548
  voice_samples = []
549
  max_length = 0
@@ -558,6 +558,9 @@ def compute_latents(voice=None, voice_samples=None, voice_latents_chunks=0, prog
558
  voice_samples[i] = pad_or_truncate(voice_samples[i], max_length)
559
 
560
  voice_latents_chunks = len(voice_samples)
 
 
 
561
  if not load_from_dataset:
562
  voice_samples, _ = load_voice(voice, load_latents=False)
563
 
 
543
  with open(dataset_path, 'r', encoding="utf-8") as f:
544
  lines = f.readlines()
545
 
546
+ print("Leveraging dataset for computing latents")
547
 
548
  voice_samples = []
549
  max_length = 0
 
558
  voice_samples[i] = pad_or_truncate(voice_samples[i], max_length)
559
 
560
  voice_latents_chunks = len(voice_samples)
561
+ if voice_latents_chunks == 0:
562
+ print("Dataset is empty!")
563
+ load_from_dataset = True
564
  if not load_from_dataset:
565
  voice_samples, _ = load_voice(voice, load_latents=False)
566