Feature Extraction
Transformers
PyTorch
CosyVoice
ONNX
onnx_parameter_store
trust-remote-code
custom_code
Instructions to use wookee3/cosyvoice3-speech-tokenizer-pt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use wookee3/cosyvoice3-speech-tokenizer-pt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="wookee3/cosyvoice3-speech-tokenizer-pt", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("wookee3/cosyvoice3-speech-tokenizer-pt", trust_remote_code=True, device_map="auto") - CosyVoice
How to use wookee3/cosyvoice3-speech-tokenizer-pt with CosyVoice:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Fix ONNX auto-download repo resolution for tokenize_from_file
Browse files- config.json +1 -1
- modeling_onnx_parameter_store.py +14 -1
config.json
CHANGED
|
@@ -15,6 +15,6 @@
|
|
| 15 |
"param_prefix": "weights",
|
| 16 |
"parameter_spec_file": "onnx_parameter_map.json",
|
| 17 |
"source_onnx_file": "speech_tokenizer_v3.onnx",
|
| 18 |
-
"source_onnx_repo_id":
|
| 19 |
"win_length": 400
|
| 20 |
}
|
|
|
|
| 15 |
"param_prefix": "weights",
|
| 16 |
"parameter_spec_file": "onnx_parameter_map.json",
|
| 17 |
"source_onnx_file": "speech_tokenizer_v3.onnx",
|
| 18 |
+
"source_onnx_repo_id": "FunAudioLLM/Fun-CosyVoice3-0.5B-2512",
|
| 19 |
"win_length": 400
|
| 20 |
}
|
modeling_onnx_parameter_store.py
CHANGED
|
@@ -161,7 +161,9 @@ class OnnxParameterStoreModel(nn.Module):
|
|
| 161 |
if cand.is_file():
|
| 162 |
return str(cand.resolve())
|
| 163 |
|
| 164 |
-
repo_id = self.config.source_onnx_repo_id
|
|
|
|
|
|
|
| 165 |
if repo_id and "/" in repo_id:
|
| 166 |
try:
|
| 167 |
from huggingface_hub import hf_hub_download
|
|
@@ -362,3 +364,14 @@ def _str_to_dtype(name: str):
|
|
| 362 |
"bool": torch.bool,
|
| 363 |
}
|
| 364 |
return table.get(name, torch.float32)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
if cand.is_file():
|
| 162 |
return str(cand.resolve())
|
| 163 |
|
| 164 |
+
repo_id = self.config.source_onnx_repo_id
|
| 165 |
+
if not repo_id and local_repo and _looks_like_repo_id(local_repo):
|
| 166 |
+
repo_id = local_repo
|
| 167 |
if repo_id and "/" in repo_id:
|
| 168 |
try:
|
| 169 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 364 |
"bool": torch.bool,
|
| 365 |
}
|
| 366 |
return table.get(name, torch.float32)
|
| 367 |
+
|
| 368 |
+
|
| 369 |
+
def _looks_like_repo_id(candidate: str) -> bool:
|
| 370 |
+
path_like = Path(candidate)
|
| 371 |
+
if path_like.exists():
|
| 372 |
+
return False
|
| 373 |
+
if candidate.startswith("/") or candidate.startswith("."):
|
| 374 |
+
return False
|
| 375 |
+
if "\\" in candidate or ":" in candidate:
|
| 376 |
+
return False
|
| 377 |
+
return "/" in candidate
|