Delete inference.py
Browse files- inference.py +0 -40
inference.py
DELETED
|
@@ -1,40 +0,0 @@
|
|
| 1 |
-
import matplotlib.pyplot as plt
|
| 2 |
-
import IPython.display as ipd
|
| 3 |
-
|
| 4 |
-
import os
|
| 5 |
-
import json
|
| 6 |
-
import math
|
| 7 |
-
import torch
|
| 8 |
-
from torch import nn
|
| 9 |
-
from torch.nn import functional as F
|
| 10 |
-
from torch.utils.data import DataLoader
|
| 11 |
-
|
| 12 |
-
import commons
|
| 13 |
-
import utils
|
| 14 |
-
from data_utils import TextAudioLoader, TextAudioCollate, TextAudioSpeakerLoader, TextAudioSpeakerCollate
|
| 15 |
-
from models import SynthesizerTrn
|
| 16 |
-
from text.symbols import symbols
|
| 17 |
-
from text import text_to_sequence
|
| 18 |
-
|
| 19 |
-
from scipy.io.wavfile import write
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
def get_text(text, hps):
|
| 23 |
-
text_norm = text_to_sequence(text, hps.data.text_cleaners)
|
| 24 |
-
if hps.data.add_blank:
|
| 25 |
-
text_norm = commons.intersperse(text_norm, 0)
|
| 26 |
-
text_norm = torch.LongTensor(text_norm)
|
| 27 |
-
return text_norm
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
hps = utils.get_hparams_from_file("./configs/yuzu.json")
|
| 31 |
-
|
| 32 |
-
net_g = SynthesizerTrn(
|
| 33 |
-
len(symbols),
|
| 34 |
-
hps.data.filter_length // 2 + 1,
|
| 35 |
-
hps.train.segment_size // hps.data.hop_length,
|
| 36 |
-
n_speakers=hps.data.n_speakers,
|
| 37 |
-
**hps.model).cuda()
|
| 38 |
-
_ = net_g.eval()
|
| 39 |
-
|
| 40 |
-
_ = utils.load_checkpoint("pretrained_models/yuzu.pth", net_g, None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|