Skip to content

Commit b2682d3

Browse files
committed
Make style
1 parent a16360a commit b2682d3

File tree

6 files changed

+37
-15
lines changed

6 files changed

+37
-15
lines changed

TTS/cs_api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ class CS_API:
8282
},
8383
}
8484

85-
8685
SUPPORTED_LANGUAGES = ["en", "es", "de", "fr", "it", "pt", "pl", "tr", "ru", "nl", "cs", "ar", "zh-cn", "ja"]
8786

8887
def __init__(self, api_token=None, model="XTTS"):
@@ -308,7 +307,11 @@ def tts_to_file(
308307
print(api.list_speakers_as_tts_models())
309308

310309
ts = time.time()
311-
wav, sr = api.tts("It took me quite a long time to develop a voice.", language="en", speaker_name=api.speakers[0].name)
310+
wav, sr = api.tts(
311+
"It took me quite a long time to develop a voice.", language="en", speaker_name=api.speakers[0].name
312+
)
312313
print(f" [i] XTTS took {time.time() - ts:.2f}s")
313314

314-
filepath = api.tts_to_file(text="Hello world!", speaker_name=api.speakers[0].name, language="en", file_path="output.wav")
315+
filepath = api.tts_to_file(
316+
text="Hello world!", speaker_name=api.speakers[0].name, language="en", file_path="output.wav"
317+
)

TTS/tts/layers/tortoise/dpm_solver.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -562,15 +562,21 @@ def get_orders_and_timesteps_for_singlestep_solver(self, steps, order, skip_type
562562
if order == 3:
563563
K = steps // 3 + 1
564564
if steps % 3 == 0:
565-
orders = [3,] * (
565+
orders = [
566+
3,
567+
] * (
566568
K - 2
567569
) + [2, 1]
568570
elif steps % 3 == 1:
569-
orders = [3,] * (
571+
orders = [
572+
3,
573+
] * (
570574
K - 1
571575
) + [1]
572576
else:
573-
orders = [3,] * (
577+
orders = [
578+
3,
579+
] * (
574580
K - 1
575581
) + [2]
576582
elif order == 2:
@@ -581,7 +587,9 @@ def get_orders_and_timesteps_for_singlestep_solver(self, steps, order, skip_type
581587
] * K
582588
else:
583589
K = steps // 2 + 1
584-
orders = [2,] * (
590+
orders = [
591+
2,
592+
] * (
585593
K - 1
586594
) + [1]
587595
elif order == 1:
@@ -1440,7 +1448,10 @@ def sample(
14401448
model_prev_list[-1] = self.model_fn(x, t)
14411449
elif method in ["singlestep", "singlestep_fixed"]:
14421450
if method == "singlestep":
1443-
(timesteps_outer, orders,) = self.get_orders_and_timesteps_for_singlestep_solver(
1451+
(
1452+
timesteps_outer,
1453+
orders,
1454+
) = self.get_orders_and_timesteps_for_singlestep_solver(
14441455
steps=steps,
14451456
order=order,
14461457
skip_type=skip_type,
@@ -1548,4 +1559,4 @@ def expand_dims(v, dims):
15481559
Returns:
15491560
a PyTorch tensor with shape [N, 1, 1, ..., 1] and the total dimension is `dims`.
15501561
"""
1551-
return v[(...,) + (None,) * (dims - 1)]
1562+
return v[(...,) + (None,) * (dims - 1)]

TTS/tts/layers/xtts/tokenizer.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import json
22
import os
33
import re
4+
from functools import cached_property
45

56
import pypinyin
67
import torch
78
from hangul_romanize import Transliter
89
from hangul_romanize.rule import academic
910
from num2words import num2words
1011
from tokenizers import Tokenizer
11-
from functools import cached_property
1212

1313
from TTS.tts.layers.xtts.zh_num2words import TextNorm as zh_num2words
1414

@@ -560,19 +560,22 @@ def __init__(self, vocab_file=None):
560560
@cached_property
561561
def katsu(self):
562562
import cutlet
563+
563564
return cutlet.Cutlet()
564-
565+
565566
def check_input_length(self, txt, lang):
566567
limit = self.char_limits.get(lang, 250)
567568
if len(txt) > limit:
568-
print(f"[!] Warning: The text length exceeds the character limit of {limit} for language '{lang}', this might cause truncated audio.")
569+
print(
570+
f"[!] Warning: The text length exceeds the character limit of {limit} for language '{lang}', this might cause truncated audio."
571+
)
569572

570573
def preprocess_text(self, txt, lang):
571574
if lang in {"ar", "cs", "de", "en", "es", "fr", "hu", "it", "nl", "pl", "pt", "ru", "tr", "zh", "zh-cn"}:
572575
txt = multilingual_cleaners(txt, lang)
573576
if lang in {"zh", "zh-cn"}:
574577
txt = chinese_transliterate(txt)
575-
elif lang == "ja":
578+
elif lang == "ja":
576579
txt = japanese_cleaners(txt, self.katsu)
577580
elif lang == "ko":
578581
txt = korean_cleaners(txt)

TTS/tts/layers/xtts/trainer/dataset.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import torch
66
import torch.nn.functional as F
77
import torch.utils.data
8+
89
from TTS.tts.models.xtts import load_audio
910

1011
torch.set_num_threads(1)

tests/xtts_tests/test_xtts_gpt_train.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@
6060

6161

6262
# Training sentences generations
63-
SPEAKER_REFERENCE = ["tests/data/ljspeech/wavs/LJ001-0002.wav"] # speaker reference to be used in training test sentences
63+
SPEAKER_REFERENCE = [
64+
"tests/data/ljspeech/wavs/LJ001-0002.wav"
65+
] # speaker reference to be used in training test sentences
6466
LANGUAGE = config_dataset.language
6567

6668

tests/xtts_tests/test_xtts_v2-0_gpt_train.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858

5959

6060
# Training sentences generations
61-
SPEAKER_REFERENCE = ["tests/data/ljspeech/wavs/LJ001-0002.wav"] # speaker reference to be used in training test sentences
61+
SPEAKER_REFERENCE = [
62+
"tests/data/ljspeech/wavs/LJ001-0002.wav"
63+
] # speaker reference to be used in training test sentences
6264
LANGUAGE = config_dataset.language
6365

6466

0 commit comments

Comments
 (0)