Spaces:
Sleeping
Sleeping
Initial commit
Browse files
echobox/src/echobox/tts.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from dataclasses import dataclass
|
2 |
from pathlib import Path
|
3 |
|
@@ -16,7 +17,7 @@ from .models.t3.modules.cond_enc import T3Cond
|
|
16 |
|
17 |
|
18 |
REPO_ID = "Lookingsoft-team/EchoBoxTTS"
|
19 |
-
|
20 |
|
21 |
def punc_norm(text: str) -> str:
|
22 |
"""
|
@@ -123,7 +124,7 @@ class EchoBoxTTS:
|
|
123 |
self.watermarker = perth.PerthImplicitWatermarker()
|
124 |
|
125 |
@classmethod
|
126 |
-
def from_local(cls, ckpt_dir, device) -> '
|
127 |
ckpt_dir = Path(ckpt_dir)
|
128 |
|
129 |
ve = VoiceEncoder()
|
@@ -156,9 +157,9 @@ class EchoBoxTTS:
|
|
156 |
return cls(t3, s3gen, ve, tokenizer, device, conds=conds)
|
157 |
|
158 |
@classmethod
|
159 |
-
def from_pretrained(cls, device) -> '
|
160 |
for fpath in ["ve.pt", "t3_cfg.pt", "s3gen.pt", "tokenizer.json", "conds.pt"]:
|
161 |
-
local_path = hf_hub_download(repo_id=REPO_ID, filename=fpath)
|
162 |
|
163 |
return cls.from_local(Path(local_path).parent, device)
|
164 |
|
|
|
1 |
+
import os
|
2 |
from dataclasses import dataclass
|
3 |
from pathlib import Path
|
4 |
|
|
|
17 |
|
18 |
|
19 |
REPO_ID = "Lookingsoft-team/EchoBoxTTS"
|
20 |
+
HF_TOKEN = os.environ.get("HF_TOKEN")
|
21 |
|
22 |
def punc_norm(text: str) -> str:
|
23 |
"""
|
|
|
124 |
self.watermarker = perth.PerthImplicitWatermarker()
|
125 |
|
126 |
@classmethod
|
127 |
+
def from_local(cls, ckpt_dir, device) -> 'EchoBoxTTS':
|
128 |
ckpt_dir = Path(ckpt_dir)
|
129 |
|
130 |
ve = VoiceEncoder()
|
|
|
157 |
return cls(t3, s3gen, ve, tokenizer, device, conds=conds)
|
158 |
|
159 |
@classmethod
|
160 |
+
def from_pretrained(cls, device) -> 'EchoBoxTTS':
|
161 |
for fpath in ["ve.pt", "t3_cfg.pt", "s3gen.pt", "tokenizer.json", "conds.pt"]:
|
162 |
+
local_path = hf_hub_download(repo_id=REPO_ID, filename=fpath, token=HF_TOKEN)
|
163 |
|
164 |
return cls.from_local(Path(local_path).parent, device)
|
165 |
|