Add intuitive error messages

This commit is contained in:
Edresson Casanova 2023-11-27 10:53:43 -03:00
parent c5cb7eb791
commit e6c51e3666
1 changed files with 9 additions and 3 deletions

View File

@ -204,7 +204,12 @@ if __name__ == "__main__":
if audio_path is None: if audio_path is None:
return "You should provide one or multiple audio files! If you provided it, probably the upload of the files is not finished yet!", "", "" return "You should provide one or multiple audio files! If you provided it, probably the upload of the files is not finished yet!", "", ""
else: else:
try:
train_meta, eval_meta, audio_total_size = format_audio_list(audio_path, target_language=language, out_path=out_path, gradio_progress=progress) train_meta, eval_meta, audio_total_size = format_audio_list(audio_path, target_language=language, out_path=out_path, gradio_progress=progress)
except:
traceback.print_exc()
error = traceback.format_exc()
return f"The data processing was interrupted due an error !! Please check the console to verify the full error message! \n Error summary: {error}", "", ""
clear_gpu_cache() clear_gpu_cache()
@ -261,9 +266,10 @@ if __name__ == "__main__":
return "You need to run the data processing step or manually set `Train CSV` and `Eval CSV` fields !", "", "", "", "" return "You need to run the data processing step or manually set `Train CSV` and `Eval CSV` fields !", "", "", "", ""
try: try:
config_path, original_xtts_checkpoint, vocab_file, exp_path, speaker_wav = train_gpt(language, num_epochs, batch_size, grad_acumm, train_csv, eval_csv, output_path=output_path) config_path, original_xtts_checkpoint, vocab_file, exp_path, speaker_wav = train_gpt(language, num_epochs, batch_size, grad_acumm, train_csv, eval_csv, output_path=output_path)
except Exception as e: except:
traceback.print_exc() traceback.print_exc()
return f"The training was interrupted due an error !! Please check the console to check the error message! Error summary: {e}", "", "", "", "" error = traceback.format_exc()
return f"The training was interrupted due an error !! Please check the console to check the full error message! \n Error summary: {error}", "", "", "", ""
# copy original files to avoid parameters changes issues # copy original files to avoid parameters changes issues
os.system(f"cp {config_path} {exp_path}") os.system(f"cp {config_path} {exp_path}")