From 3f0f94d92e1bf3103f4e811cb02b5bd509aeec7d Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 12 Dec 2022 19:40:37 -0500 Subject: [PATCH] better debugging, add gpu info, fix ffmpeg bug with -y --- voice_conversion/softvc/cli_inference.py | 7 +++++++ voice_conversion/softvc/gpu_utils.py | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 voice_conversion/softvc/gpu_utils.py diff --git a/voice_conversion/softvc/cli_inference.py b/voice_conversion/softvc/cli_inference.py index deaba29..552c519 100755 --- a/voice_conversion/softvc/cli_inference.py +++ b/voice_conversion/softvc/cli_inference.py @@ -12,6 +12,7 @@ import sys import sys import torch import torchaudio + from collections import OrderedDict from time import time from torch.nn.modules.utils import consume_prefix_in_state_dict_if_present @@ -27,8 +28,12 @@ sys.path.append("./hifigan/") from hifigan.generator import HifiganGenerator from hifigan.generator import consume_prefix_in_state_dict_if_present +from gpu_utils import print_gpu_info + # =========================================== +print_gpu_info() + parser = argparse.ArgumentParser() parser.add_argument('--acoustic_model_filename', type=str, required=True) parser.add_argument('--hifigan_model_filename', type=str, required=True) @@ -129,6 +134,7 @@ def truncate_source_audio(audio_source_filename, output_filename, seconds): # Run ffmpeg's ffprobe command = [ "ffmpeg", + "-y", # Force file overwrite "-i", audio_source_filename, "-t", @@ -138,6 +144,7 @@ def truncate_source_audio(audio_source_filename, output_filename, seconds): output_filename, ] + print(f"Truncating source audio to {seconds} seconds", flush=True) pipe = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) out, err = pipe.communicate() diff --git a/voice_conversion/softvc/gpu_utils.py b/voice_conversion/softvc/gpu_utils.py new file mode 100644 index 0000000..81232ce --- /dev/null +++ b/voice_conversion/softvc/gpu_utils.py @@ -0,0 +1,19 @@ +import sys +import torch + +# TODO: De-duplicate this +def print_gpu_info(): + print('\n========================================') + print('Python interpreter', sys.executable) + print('PyTorch version', torch.__version__) + print('CUDA Available?', torch.cuda.is_available()) + print('CUDA Device count', torch.cuda.device_count()) + print('CUDA architectures library was compiled for', torch.cuda.get_arch_list()) + + #try: + # from tensorflow.python.client import device_lib + # print('local devices', str(device_lib.list_local_devices()).replace("\n", "\n ")) + #except ImportError: + # print('no tensorflow - cannot list devices') + # pass + print('========================================\n', flush=True) \ No newline at end of file