wavegrad refactoring, fixing tests for glow-tts and wavegrad

This commit is contained in:
erogol
2020-10-29 15:47:15 +01:00
parent 946a0c0fb9
commit 39c71ee8a9
6 changed files with 49 additions and 56 deletions
+2 -2
View File
@@ -62,7 +62,7 @@ class GE2ELossTests(unittest.TestCase):
assert output.item() >= 0.0
# check speaker loss with orthogonal d-vectors
dummy_input = T.empty(3, 64)
dummy_input = T.nn.init.orthogonal(dummy_input)
dummy_input = T.nn.init.orthogonal_(dummy_input)
dummy_input = T.cat(
[
dummy_input[0].repeat(5, 1, 1).transpose(0, 1),
@@ -91,7 +91,7 @@ class AngleProtoLossTests(unittest.TestCase):
# check speaker loss with orthogonal d-vectors
dummy_input = T.empty(3, 64)
dummy_input = T.nn.init.orthogonal(dummy_input)
dummy_input = T.nn.init.orthogonal_(dummy_input)
dummy_input = T.cat(
[
dummy_input[0].repeat(5, 1, 1).transpose(0, 1),
+3 -3
View File
@@ -6,12 +6,12 @@ if [[ ! -f tests/outputs/checkpoint_10.pth.tar ]]; then
exit 1
fi
rm -f dist/*.whl
python setup.py --quiet bdist_wheel --checkpoint tests/outputs/checkpoint_10.pth.tar --model_config tests/outputs/dummy_model_config.json
python -m venv /tmp/venv
source /tmp/venv/bin/activate
pip install --quiet --upgrade pip setuptools wheel
rm -f dist/*.whl
python setup.py --quiet bdist_wheel --checkpoint tests/outputs/checkpoint_10.pth.tar --model_config tests/outputs/dummy_model_config.json
pip install --quiet dist/TTS*.whl
# this is related to https://github.com/librosa/librosa/issues/1160
+10 -1
View File
@@ -30,9 +30,18 @@ class WavegradTrainTest(unittest.TestCase):
upsample_dilations=[[1, 2, 1, 2], [1, 2, 1, 2],
[1, 2, 4, 8], [1, 2, 4, 8],
[1, 2, 4, 8]])
model_ref = Wavegrad(in_channels=80,
out_channels=1,
upsample_factors=[5, 5, 3, 2, 2],
upsample_dilations=[[1, 2, 1, 2], [1, 2, 1, 2],
[1, 2, 4, 8], [1, 2, 4, 8],
[1, 2, 4, 8]])
model.train()
model.to(device)
model_ref = copy.deepcopy(model)
model.compute_noise_level(1000, 1e-6, 1e-2)
model_ref.load_state_dict(model.state_dict())
model_ref.to(device)
count = 0
for param, param_ref in zip(model.parameters(),
model_ref.parameters()):