forked from coqui-ai/TTS
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from eginhard/disable-wavegrad-test
test(vocoder): disable wavegrad training test in CI
- Loading branch information
Showing
1 changed file
with
47 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,54 @@ | ||
import glob | ||
import os | ||
import shutil | ||
import unittest | ||
|
||
from tests import get_device_id, get_tests_output_path, run_cli | ||
from TTS.vocoder.configs import WavegradConfig | ||
|
||
config_path = os.path.join(get_tests_output_path(), "test_vocoder_config.json") | ||
output_path = os.path.join(get_tests_output_path(), "train_outputs") | ||
|
||
config = WavegradConfig( | ||
batch_size=8, | ||
eval_batch_size=8, | ||
num_loader_workers=0, | ||
num_eval_loader_workers=0, | ||
run_eval=True, | ||
test_delay_epochs=-1, | ||
epochs=1, | ||
seq_len=8192, | ||
eval_split_size=1, | ||
print_step=1, | ||
print_eval=True, | ||
data_path="tests/data/ljspeech", | ||
output_path=output_path, | ||
test_noise_schedule={"min_val": 1e-6, "max_val": 1e-2, "num_steps": 2}, | ||
) | ||
config.audio.do_trim_silence = True | ||
config.audio.trim_db = 60 | ||
config.save_json(config_path) | ||
|
||
# train the model for one epoch | ||
command_train = f"CUDA_VISIBLE_DEVICES='{get_device_id()}' python TTS/bin/train_vocoder.py --config_path {config_path} " | ||
run_cli(command_train) | ||
|
||
# Find latest folder | ||
continue_path = max(glob.glob(os.path.join(output_path, "*/")), key=os.path.getmtime) | ||
|
||
# restore the model and continue training for one more epoch | ||
command_train = ( | ||
f"CUDA_VISIBLE_DEVICES='{get_device_id()}' python TTS/bin/train_vocoder.py --continue_path {continue_path} " | ||
) | ||
run_cli(command_train) | ||
shutil.rmtree(continue_path) | ||
|
||
class WavegradTrainingTest(unittest.TestCase): | ||
# TODO: Reactivate after improving CI run times | ||
# This test currently takes ~2h on CI (15min/step vs 8sec/step locally) | ||
if os.getenv("GITHUB_ACTIONS") == "true": | ||
__test__ = False | ||
|
||
def test_train(self): # pylint: disable=no-self-use | ||
config_path = os.path.join(get_tests_output_path(), "test_vocoder_config.json") | ||
output_path = os.path.join(get_tests_output_path(), "train_outputs") | ||
|
||
config = WavegradConfig( | ||
batch_size=8, | ||
eval_batch_size=8, | ||
num_loader_workers=0, | ||
num_eval_loader_workers=0, | ||
run_eval=True, | ||
test_delay_epochs=-1, | ||
epochs=1, | ||
seq_len=8192, | ||
eval_split_size=1, | ||
print_step=1, | ||
print_eval=True, | ||
data_path="tests/data/ljspeech", | ||
output_path=output_path, | ||
test_noise_schedule={"min_val": 1e-6, "max_val": 1e-2, "num_steps": 2}, | ||
) | ||
config.audio.do_trim_silence = True | ||
config.audio.trim_db = 60 | ||
config.save_json(config_path) | ||
|
||
# train the model for one epoch | ||
command_train = ( | ||
f"CUDA_VISIBLE_DEVICES='{get_device_id()}' python TTS/bin/train_vocoder.py --config_path {config_path} " | ||
) | ||
run_cli(command_train) | ||
|
||
# Find latest folder | ||
continue_path = max(glob.glob(os.path.join(output_path, "*/")), key=os.path.getmtime) | ||
|
||
# restore the model and continue training for one more epoch | ||
command_train = ( | ||
f"CUDA_VISIBLE_DEVICES='{get_device_id()}' python TTS/bin/train_vocoder.py --continue_path {continue_path} " | ||
) | ||
run_cli(command_train) | ||
shutil.rmtree(continue_path) |