Skip to content

Commit

Permalink
update example & minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lich99 committed May 30, 2024
1 parent 6c52dfa commit d2c7d95
Show file tree
Hide file tree
Showing 3 changed files with 235 additions and 78 deletions.
5 changes: 3 additions & 2 deletions ChatTTS/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

logging.basicConfig(level = logging.INFO)

torch._dynamo.config.suppress_errors = True
torch.set_float32_matmul_precision('medium')

class Chat:
def __init__(self, ):
Expand Down Expand Up @@ -138,6 +136,9 @@ def infer(

assert self.check_model(use_decoder=use_decoder)

if not isinstance(text, list):
text = [text]

if do_text_normalization:
for i, t in enumerate(text):
_lang = detect_language(t) if lang is None else lang
Expand Down
2 changes: 1 addition & 1 deletion ChatTTS/utils/infer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> to
def count_invalid_characters(s):

s = re.sub(r'\[uv_break\]|\[laugh\]|\[lbreak\]', '', s)
pattern = re.compile(r'[^\u4e00-\u9fffA-Za-z,。,\. ]')
pattern = re.compile(r'[^\u4e00-\u9fffA-Za-z,。,\. ]')
non_alphabetic_chinese_chars = pattern.findall(s)
return set(non_alphabetic_chinese_chars)

Expand Down
306 changes: 231 additions & 75 deletions infer.ipynb → example.ipynb

Large diffs are not rendered by default.

0 comments on commit d2c7d95

Please sign in to comment.