mirror of https://github.com/coqui-ai/TTS.git
Remove `/` prefix from the relative path (#2065)
parent
843fa6f3fa
commit
dae79b0acd
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
import sys
|
||||
from collections import Counter
|
||||
from pathlib import Path
|
||||
|
@ -12,20 +13,16 @@ from TTS.tts.datasets.formatters import *
|
|||
def split_dataset(items, eval_split_max_size=None, eval_split_size=0.01):
|
||||
"""Split a dataset into train and eval. Consider speaker distribution in multi-speaker training.
|
||||
|
||||
Args:
|
||||
<<<<<<< HEAD
|
||||
items (List[List]):
|
||||
A list of samples. Each sample is a list of `[audio_path, text, speaker_id]`.
|
||||
Args:
|
||||
items (List[List]):
|
||||
A list of samples. Each sample is a list of `[audio_path, text, speaker_id]`.
|
||||
|
||||
eval_split_max_size (int):
|
||||
Number maximum of samples to be used for evaluation in proportion split. Defaults to None (Disabled).
|
||||
eval_split_max_size (int):
|
||||
Number maximum of samples to be used for evaluation in proportion split. Defaults to None (Disabled).
|
||||
|
||||
eval_split_size (float):
|
||||
If between 0.0 and 1.0 represents the proportion of the dataset to include in the evaluation set.
|
||||
If > 1, represents the absolute number of evaluation samples. Defaults to 0.01 (1%).
|
||||
=======
|
||||
items (List[List]): A list of samples. Each sample is a list of `[text, audio_path, speaker_id]`.
|
||||
>>>>>>> Fix docstring
|
||||
eval_split_size (float):
|
||||
If between 0.0 and 1.0 represents the proportion of the dataset to include in the evaluation set.
|
||||
If > 1, represents the absolute number of evaluation samples. Defaults to 0.01 (1%).
|
||||
"""
|
||||
speakers = [item["speaker_name"] for item in items]
|
||||
is_multi_speaker = len(set(speakers)) > 1
|
||||
|
@ -64,10 +61,9 @@ def add_extra_keys(metadata, language, dataset_name):
|
|||
# add language name
|
||||
item["language"] = language
|
||||
# add unique audio name
|
||||
relfilepath = os.path.splitext(item["audio_file"].replace(item["root_path"], ""))[0]
|
||||
relfilepath = os.path.splitext(os.path.relpath(item["audio_file"], item["root_path"]))[0]
|
||||
audio_unique_name = f"{dataset_name}#{relfilepath}"
|
||||
item["audio_unique_name"] = audio_unique_name
|
||||
|
||||
return metadata
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,9 @@ def get_tests_data_path():
|
|||
|
||||
def get_tests_output_path():
|
||||
"""Returns the path to the directory for test outputs."""
|
||||
return os.path.join(get_tests_path(), "outputs")
|
||||
path = os.path.join(get_tests_path(), "outputs")
|
||||
os.makedirs(path, exist_ok=True)
|
||||
return path
|
||||
|
||||
|
||||
def run_cli(command):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"#/wavs/LJ001-0001": {
|
||||
"#wavs/LJ001-0001": {
|
||||
"name": "ljspeech-0",
|
||||
"embedding": [
|
||||
0.05539746582508087,
|
||||
|
@ -260,7 +260,7 @@
|
|||
-0.09469571709632874
|
||||
]
|
||||
},
|
||||
"#/wavs/LJ001-0002": {
|
||||
"#wavs/LJ001-0002": {
|
||||
"name": "ljspeech-1",
|
||||
"embedding": [
|
||||
0.05539746582508087,
|
||||
|
@ -521,7 +521,7 @@
|
|||
-0.09469571709632874
|
||||
]
|
||||
},
|
||||
"#/wavs/LJ001-0003": {
|
||||
"#wavs/LJ001-0003": {
|
||||
"name": "ljspeech-2",
|
||||
"embedding": [
|
||||
0.05539746582508087,
|
||||
|
@ -782,7 +782,7 @@
|
|||
-0.09469571709632874
|
||||
]
|
||||
},
|
||||
"#/wavs/LJ001-0004": {
|
||||
"#wavs/LJ001-0004": {
|
||||
"name": "ljspeech-3",
|
||||
"embedding": [
|
||||
0.05539746582508087,
|
||||
|
@ -1043,7 +1043,7 @@
|
|||
-0.09469571709632874
|
||||
]
|
||||
},
|
||||
"#/wavs/LJ001-0005": {
|
||||
"#wavs/LJ001-0005": {
|
||||
"name": "ljspeech-4",
|
||||
"embedding": [
|
||||
0.05539746582508087,
|
||||
|
@ -1304,7 +1304,7 @@
|
|||
-0.09469571709632874
|
||||
]
|
||||
},
|
||||
"#/wavs/LJ001-0006": {
|
||||
"#wavs/LJ001-0006": {
|
||||
"name": "ljspeech-5",
|
||||
"embedding": [
|
||||
0.05539746582508087,
|
||||
|
@ -1565,7 +1565,7 @@
|
|||
-0.09469571709632874
|
||||
]
|
||||
},
|
||||
"#/wavs/LJ001-0007": {
|
||||
"#wavs/LJ001-0007": {
|
||||
"name": "ljspeech-6",
|
||||
"embedding": [
|
||||
0.05539746582508087,
|
||||
|
@ -1826,7 +1826,7 @@
|
|||
-0.09469571709632874
|
||||
]
|
||||
},
|
||||
"#/wavs/LJ001-0008": {
|
||||
"#wavs/LJ001-0008": {
|
||||
"name": "ljspeech-7",
|
||||
"embedding": [
|
||||
0.05539746582508087,
|
||||
|
@ -2087,7 +2087,7 @@
|
|||
-0.09469571709632874
|
||||
]
|
||||
},
|
||||
"#/wavs/LJ001-0009": {
|
||||
"#wavs/LJ001-0009": {
|
||||
"name": "ljspeech-8",
|
||||
"embedding": [
|
||||
0.05539746582508087,
|
||||
|
@ -2348,7 +2348,7 @@
|
|||
-0.09469571709632874
|
||||
]
|
||||
},
|
||||
"#/wavs/LJ001-0010": {
|
||||
"#wavs/LJ001-0010": {
|
||||
"name": "ljspeech-9",
|
||||
"embedding": [
|
||||
0.05539746582508087,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
import unittest
|
||||
|
||||
from tests import get_tests_output_path
|
||||
from tests import get_tests_input_path
|
||||
from TTS.config import load_config
|
||||
from TTS.tts.models import setup_model
|
||||
from TTS.utils.io import save_checkpoint
|
||||
|
@ -12,14 +12,14 @@ class SynthesizerTest(unittest.TestCase):
|
|||
# pylint: disable=R0201
|
||||
def _create_random_model(self):
|
||||
# pylint: disable=global-statement
|
||||
config = load_config(os.path.join(get_tests_output_path(), "dummy_model_config.json"))
|
||||
config = load_config(os.path.join(get_tests_input_path(), "dummy_model_config.json"))
|
||||
model = setup_model(config)
|
||||
output_path = os.path.join(get_tests_output_path())
|
||||
output_path = os.path.join(get_tests_input_path())
|
||||
save_checkpoint(config, model, None, None, 10, 1, output_path)
|
||||
|
||||
def test_in_out(self):
|
||||
self._create_random_model()
|
||||
tts_root_path = get_tests_output_path()
|
||||
tts_root_path = get_tests_input_path()
|
||||
tts_checkpoint = os.path.join(tts_root_path, "checkpoint_10.pth")
|
||||
tts_config = os.path.join(tts_root_path, "dummy_model_config.json")
|
||||
synthesizer = Synthesizer(tts_checkpoint, tts_config, None, None)
|
||||
|
|
Loading…
Reference in New Issue