remote false start

This commit is contained in:
Brandon Thomas
2022-06-30 18:31:31 -04:00
parent 6352d838c5
commit 1f1d9a3e68
4 changed files with 0 additions and 44 deletions
View File
-15
View File
@@ -1,15 +0,0 @@
"""
Base class for Arpabet Sequence Transformers.
"""
class ArpabetTransformer:
def transform_text(self, text):
"""
Input: String text sequence
Output: 2-dimensional tensor sequence
"""
pass
-29
View File
@@ -1,29 +0,0 @@
import torch
import numpy as np
from base import ArpabetTransformer
class EnglishMixedArpabetTransformerV1(ArpabetTransformer):
def transform_text(self, text):
pre_sequence = self._handle_multi_lines(text)
return self._convert_to_sequence(pre_sequence)
def _handle_multi_lines(self, text):
# NB: This code is adapted from vanilla Tacotron. It's not very graceful.
pre_sequence = ''
for line in text.split("\n"):
if len(line) < 1:
continue
if line[-1] != ";":
line = line + ";"
pre_sequence += line
return pre_sequence
def _convert_to_sequence(self, pre_sequence_text):
with torch.no_grad():
# save VRAM by not including gradients
sequence = np.array(text_to_sequence(pre_sequence_text, ['english_cleaners']))[None, :]
sequence = torch.autograd.Variable(torch.from_numpy(sequence)).cuda().long()
return sequence
View File