Spaces:
Running on Zero
Running on Zero
Use original S3Gen checkpoint
Browse files
chatterbox/src/chatterbox/tts.py
CHANGED
|
@@ -24,7 +24,6 @@ from .models.t3.modules.cond_enc import T3Cond
|
|
| 24 |
REPO_ID = "ResembleAI/chatterbox"
|
| 25 |
BASE_REPO_ID = "ResembleAI/chatterbox"
|
| 26 |
T3_FILENAME = "t3_mtl23ls_v3.safetensors"
|
| 27 |
-
S3GEN_FILENAME = "s3gen_v3.safetensors"
|
| 28 |
TOKENIZER_FILENAME = "grapheme_mtl_merged_expanded_v1.json"
|
| 29 |
CANGJIE_FILENAME = "Cangjie5_TC.json"
|
| 30 |
T3_TEXT_VOCAB_SIZE = 2454
|
|
@@ -239,8 +238,7 @@ class ChatterboxTTS:
|
|
| 239 |
|
| 240 |
s3gen = S3Gen()
|
| 241 |
s3gen.load_state_dict(
|
| 242 |
-
|
| 243 |
-
strict=False,
|
| 244 |
)
|
| 245 |
s3gen.to(device).eval()
|
| 246 |
|
|
@@ -258,7 +256,7 @@ class ChatterboxTTS:
|
|
| 258 |
@classmethod
|
| 259 |
def from_pretrained(cls, device: torch.device) -> 'ChatterboxTTS':
|
| 260 |
token = os.getenv("HF_TOKEN")
|
| 261 |
-
base_files = ["ve.pt",
|
| 262 |
base_dir = Path(
|
| 263 |
snapshot_download(
|
| 264 |
repo_id=BASE_REPO_ID,
|
|
|
|
| 24 |
REPO_ID = "ResembleAI/chatterbox"
|
| 25 |
BASE_REPO_ID = "ResembleAI/chatterbox"
|
| 26 |
T3_FILENAME = "t3_mtl23ls_v3.safetensors"
|
|
|
|
| 27 |
TOKENIZER_FILENAME = "grapheme_mtl_merged_expanded_v1.json"
|
| 28 |
CANGJIE_FILENAME = "Cangjie5_TC.json"
|
| 29 |
T3_TEXT_VOCAB_SIZE = 2454
|
|
|
|
| 238 |
|
| 239 |
s3gen = S3Gen()
|
| 240 |
s3gen.load_state_dict(
|
| 241 |
+
torch.load(ckpt_dir / "s3gen.pt", weights_only=True, map_location="cpu")
|
|
|
|
| 242 |
)
|
| 243 |
s3gen.to(device).eval()
|
| 244 |
|
|
|
|
| 256 |
@classmethod
|
| 257 |
def from_pretrained(cls, device: torch.device) -> 'ChatterboxTTS':
|
| 258 |
token = os.getenv("HF_TOKEN")
|
| 259 |
+
base_files = ["ve.pt", "s3gen.pt", TOKENIZER_FILENAME, CANGJIE_FILENAME, "conds.pt"]
|
| 260 |
base_dir = Path(
|
| 261 |
snapshot_download(
|
| 262 |
repo_id=BASE_REPO_ID,
|