mirror of
https://github.com/wassname/TTS.git
synced 2026-09-09 11:16:00 +08:00
Make style
This commit is contained in:
@@ -31,7 +31,7 @@ dataset_config_pt = BaseDatasetConfig(
|
||||
class TestFindUniquePhonemes(unittest.TestCase):
|
||||
@staticmethod
|
||||
def test_espeak_phonemes():
|
||||
# prepare the config
|
||||
# prepare the config
|
||||
config = VitsConfig(
|
||||
batch_size=2,
|
||||
eval_batch_size=2,
|
||||
@@ -52,9 +52,7 @@ class TestFindUniquePhonemes(unittest.TestCase):
|
||||
config.save_json(config_path)
|
||||
|
||||
# run test
|
||||
run_cli(
|
||||
f'CUDA_VISIBLE_DEVICES="" python TTS/bin/find_unique_phonemes.py --config_path "{config_path}"'
|
||||
)
|
||||
run_cli(f'CUDA_VISIBLE_DEVICES="" python TTS/bin/find_unique_phonemes.py --config_path "{config_path}"')
|
||||
|
||||
@staticmethod
|
||||
def test_no_espeak_phonemes():
|
||||
@@ -79,6 +77,4 @@ class TestFindUniquePhonemes(unittest.TestCase):
|
||||
config.save_json(config_path)
|
||||
|
||||
# run test
|
||||
run_cli(
|
||||
f'CUDA_VISIBLE_DEVICES="" python TTS/bin/find_unique_phonemes.py --config_path "{config_path}"'
|
||||
)
|
||||
run_cli(f'CUDA_VISIBLE_DEVICES="" python TTS/bin/find_unique_phonemes.py --config_path "{config_path}"')
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
from TTS.tts.datasets import load_tts_samples
|
||||
from TTS.config.shared_configs import BaseDatasetConfig
|
||||
from TTS.tts.utils.languages import get_language_weighted_sampler
|
||||
import torch
|
||||
import functools
|
||||
|
||||
import torch
|
||||
|
||||
from TTS.config.shared_configs import BaseDatasetConfig
|
||||
from TTS.tts.datasets import load_tts_samples
|
||||
from TTS.tts.utils.languages import get_language_weighted_sampler
|
||||
|
||||
# Fixing random state to avoid random fails
|
||||
torch.manual_seed(0)
|
||||
|
||||
@@ -25,18 +27,19 @@ dataset_config_pt = BaseDatasetConfig(
|
||||
|
||||
# Adding the EN samples twice to create an unbalanced dataset
|
||||
train_samples, eval_samples = load_tts_samples(
|
||||
[dataset_config_en, dataset_config_en, dataset_config_pt],
|
||||
eval_split=True
|
||||
[dataset_config_en, dataset_config_en, dataset_config_pt], eval_split=True
|
||||
)
|
||||
|
||||
|
||||
def is_balanced(lang_1, lang_2):
|
||||
return 0.85 < lang_1/lang_2 < 1.2
|
||||
return 0.85 < lang_1 / lang_2 < 1.2
|
||||
|
||||
|
||||
random_sampler = torch.utils.data.RandomSampler(train_samples)
|
||||
ids = functools.reduce(lambda a, b: a + b, [list(random_sampler) for i in range(100)])
|
||||
en, pt = 0, 0
|
||||
for index in ids:
|
||||
if train_samples[index][3] == 'en':
|
||||
if train_samples[index][3] == "en":
|
||||
en += 1
|
||||
else:
|
||||
pt += 1
|
||||
@@ -47,7 +50,7 @@ weighted_sampler = get_language_weighted_sampler(train_samples)
|
||||
ids = functools.reduce(lambda a, b: a + b, [list(weighted_sampler) for i in range(100)])
|
||||
en, pt = 0, 0
|
||||
for index in ids:
|
||||
if train_samples[index][3] == 'en':
|
||||
if train_samples[index][3] == "en":
|
||||
en += 1
|
||||
else:
|
||||
pt += 1
|
||||
|
||||
Reference in New Issue
Block a user