From b60b75ea89ed46bb2e814eb5de184f82894d68be Mon Sep 17 00:00:00 2001 From: peijiyang Date: Wed, 8 Sep 2021 11:17:20 +0800 Subject: [PATCH] remove hardcode and unused part --- hifigan/config_16k_.json | 8 +----- hifigan/inference.py | 25 ----------------- hifigan/test.py | 58 ---------------------------------------- 3 files changed, 1 insertion(+), 90 deletions(-) delete mode 100644 hifigan/test.py diff --git a/hifigan/config_16k_.json b/hifigan/config_16k_.json index c2f30fe..16c940b 100644 --- a/hifigan/config_16k_.json +++ b/hifigan/config_16k_.json @@ -27,11 +27,5 @@ "fmax": 7600, "fmax_for_loss": null, - "num_workers": 4, - - "dist_config": { - "dist_backend": "nccl", - "dist_url": "tcp://localhost:54321", - "world_size": 1 - } + "num_workers": 4 } diff --git a/hifigan/inference.py b/hifigan/inference.py index b663e63..ff48c79 100644 --- a/hifigan/inference.py +++ b/hifigan/inference.py @@ -71,28 +71,3 @@ def infer_waveform(mel, progress_callback=None): return audio - - -# if __name__ == "__main__": - -# mel = np.load("./mel-T0055G0184S0349.wav_00.npy") -# # mel = torch.FloatTensor(mel.T).to(device) -# # mel = mel.unsqueeze(0) - -# load_model("../../../TTS/Vocoder/outputs/hifi-gan/models/g_00930000") -# audio = infer_waveform(mel) - -# sf.write("b.wav", audio, samplerate=16000) - - - # with torch.no_grad(): - # y_g_hat = generator(mel) - # audio = y_g_hat.squeeze() - - - # audio = audio.cpu().numpy() - # sf.write("a.wav", audio, samplerate=16000) - - -# import IPython.display as ipd -# ipd.Audio(audio, rate=16000) \ No newline at end of file diff --git a/hifigan/test.py b/hifigan/test.py deleted file mode 100644 index bdbcaf0..0000000 --- a/hifigan/test.py +++ /dev/null @@ -1,58 +0,0 @@ -from __future__ import absolute_import, division, print_function, unicode_literals - -import glob -import os -import argparse -import json -import torch -import numpy as np -from scipy.io.wavfile import write -from env import AttrDict -from meldataset import mel_spectrogram, MAX_WAV_VALUE, load_wav -from models import Generator -import soundfile as sf - - -def load_checkpoint(filepath, device): - assert os.path.isfile(filepath) - print("Loading '{}'".format(filepath)) - checkpoint_dict = torch.load(filepath, map_location=device) - print("Complete.") - return checkpoint_dict - - -h = None -device = None - - -with open("config_16k_.json") as f: - data = f.read() -json_config = json.loads(data) -h = AttrDict(json_config) -torch.manual_seed(h.seed) -device = torch.device("cpu") - - -generator = Generator(h).to(device) -state_dict_g = load_checkpoint("../../../TTS/Vocoder/outputs/hifi-gan/models/g_00930000", device) -generator.load_state_dict(state_dict_g['generator']) -generator.eval() -generator.remove_weight_norm() - - -mel = np.load("./mel-T0055G0184S0349.wav_00.npy") -mel = torch.FloatTensor(mel.T).to(device) -mel = mel.unsqueeze(0) - - -with torch.no_grad(): - y_g_hat = generator(mel) - audio = y_g_hat.squeeze() - - -audio = audio.cpu().numpy() -sf.write("a.wav", audio, samplerate=16000) - - -# import IPython.display as ipd -# ipd.Audio(audio, rate=16000) \ No newline at end of file