Audio-to-Audio
audio
speech
voice-conversion
Project Beatrice commited on
Commit
7eb42ff
·
1 Parent(s): fc5bcf3

Fix target_ids used in validation

Browse files
Files changed (1) hide show
  1. beatrice_trainer/__main__.py +5 -6
beatrice_trainer/__main__.py CHANGED
@@ -2347,12 +2347,11 @@ def prepare_training():
2347
  while True:
2348
  yield from range(n_speakers)
2349
 
 
2350
  for file in sorted(in_test_wav_dir.iterdir())[:max_n_test_files]:
2351
  if file.suffix.lower() not in AUDIO_FILE_SUFFIXES:
2352
  continue
2353
- target_ids = [
2354
- next(get_target_id_generator()) for _ in range(min(8, n_speakers))
2355
- ]
2356
  test_filelist.append((file, target_ids))
2357
  return test_filelist
2358
 
@@ -2777,10 +2776,10 @@ if __name__ == "__main__":
2777
  for d in range(
2778
  min(len(target_ids), 1 + (12 - i - 1) // len(test_filelist))
2779
  ):
2780
- idx_in_barch = n_added_wavs % len(target_ids)
2781
  writer.add_audio(
2782
- f"converted/y_hat_{i:02d}_{target_ids[0]:03d}_{pitch_shift_semitones[0]:+02d}",
2783
- converted[0],
2784
  iteration + 1,
2785
  h.out_sample_rate,
2786
  )
 
2347
  while True:
2348
  yield from range(n_speakers)
2349
 
2350
+ target_id_generator = get_target_id_generator()
2351
  for file in sorted(in_test_wav_dir.iterdir())[:max_n_test_files]:
2352
  if file.suffix.lower() not in AUDIO_FILE_SUFFIXES:
2353
  continue
2354
+ target_ids = [next(target_id_generator) for _ in range(min(8, n_speakers))]
 
 
2355
  test_filelist.append((file, target_ids))
2356
  return test_filelist
2357
 
 
2776
  for d in range(
2777
  min(len(target_ids), 1 + (12 - i - 1) // len(test_filelist))
2778
  ):
2779
+ idx_in_batch = n_added_wavs % len(target_ids)
2780
  writer.add_audio(
2781
+ f"converted/y_hat_{i:02d}_{target_ids[idx_in_batch]:03d}_{pitch_shift_semitones[idx_in_batch]:+02d}",
2782
+ converted[idx_in_batch],
2783
  iteration + 1,
2784
  h.out_sample_rate,
2785
  )