|
1 |
| -import os |
2 |
| -import unittest |
3 |
| - |
4 | 1 | import torch
|
5 | 2 |
|
6 |
| -from tests import get_tests_output_path, run_cli |
| 3 | +from tests import run_cli |
7 | 4 | from TTS.config.shared_configs import BaseDatasetConfig
|
8 | 5 | from TTS.tts.configs.vits_config import VitsConfig
|
9 | 6 |
|
10 | 7 | torch.manual_seed(1)
|
11 | 8 |
|
12 |
| -config_path = os.path.join(get_tests_output_path(), "test_model_config.json") |
13 |
| - |
14 | 9 | dataset_config_en = BaseDatasetConfig(
|
15 | 10 | formatter="ljspeech",
|
16 | 11 | meta_file_train="metadata.csv",
|
|
30 | 25 | """
|
31 | 26 |
|
32 | 27 |
|
33 |
| -# pylint: disable=protected-access |
34 |
| -class TestFindUniquePhonemes(unittest.TestCase): |
35 |
| - @staticmethod |
36 |
| - def test_espeak_phonemes(): |
37 |
| - # prepare the config |
38 |
| - config = VitsConfig( |
39 |
| - batch_size=2, |
40 |
| - eval_batch_size=2, |
41 |
| - num_loader_workers=0, |
42 |
| - num_eval_loader_workers=0, |
43 |
| - text_cleaner="english_cleaners", |
44 |
| - use_phonemes=True, |
45 |
| - phoneme_language="en-us", |
46 |
| - phoneme_cache_path="tests/data/ljspeech/phoneme_cache/", |
47 |
| - run_eval=True, |
48 |
| - test_delay_epochs=-1, |
49 |
| - epochs=1, |
50 |
| - print_step=1, |
51 |
| - print_eval=True, |
52 |
| - datasets=[dataset_config_en], |
53 |
| - ) |
54 |
| - config.save_json(config_path) |
55 |
| - |
56 |
| - # run test |
57 |
| - run_cli(f'CUDA_VISIBLE_DEVICES="" python TTS/bin/find_unique_phonemes.py --config_path "{config_path}"') |
58 |
| - |
59 |
| - @staticmethod |
60 |
| - def test_no_espeak_phonemes(): |
61 |
| - # prepare the config |
62 |
| - config = VitsConfig( |
63 |
| - batch_size=2, |
64 |
| - eval_batch_size=2, |
65 |
| - num_loader_workers=0, |
66 |
| - num_eval_loader_workers=0, |
67 |
| - text_cleaner="english_cleaners", |
68 |
| - use_phonemes=True, |
69 |
| - phoneme_language="en-us", |
70 |
| - phoneme_cache_path="tests/data/ljspeech/phoneme_cache/", |
71 |
| - run_eval=True, |
72 |
| - test_delay_epochs=-1, |
73 |
| - epochs=1, |
74 |
| - print_step=1, |
75 |
| - print_eval=True, |
76 |
| - datasets=[dataset_config_en], |
77 |
| - ) |
78 |
| - config.save_json(config_path) |
79 |
| - |
80 |
| - # run test |
81 |
| - run_cli(f'CUDA_VISIBLE_DEVICES="" python TTS/bin/find_unique_phonemes.py --config_path "{config_path}"') |
| 28 | +def test_find_phonemes(tmp_path): |
| 29 | + # prepare the config |
| 30 | + config_path = tmp_path / "test_model_config.json" |
| 31 | + config = VitsConfig( |
| 32 | + batch_size=2, |
| 33 | + eval_batch_size=2, |
| 34 | + num_loader_workers=0, |
| 35 | + num_eval_loader_workers=0, |
| 36 | + text_cleaner="english_cleaners", |
| 37 | + use_phonemes=True, |
| 38 | + phoneme_language="en-us", |
| 39 | + phoneme_cache_path="tests/data/ljspeech/phoneme_cache/", |
| 40 | + run_eval=True, |
| 41 | + test_delay_epochs=-1, |
| 42 | + epochs=1, |
| 43 | + print_step=1, |
| 44 | + print_eval=True, |
| 45 | + datasets=[dataset_config_en], |
| 46 | + ) |
| 47 | + config.save_json(config_path) |
| 48 | + |
| 49 | + # run test |
| 50 | + run_cli(f'CUDA_VISIBLE_DEVICES="" python TTS/bin/find_unique_phonemes.py --config_path "{config_path}"') |
0 commit comments