mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
Compare commits
4 Commits
6779827c93
...
8964e8b87f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8964e8b87f | ||
|
|
4402e95b0f | ||
|
|
f5051c55cd | ||
|
|
e5cc659f40 |
10
export.py
10
export.py
@ -1,10 +0,0 @@
|
||||
# method2, inference from local path
|
||||
from funasr import AutoModel
|
||||
|
||||
model = AutoModel(
|
||||
model="iic/emotion2vec_base",
|
||||
hub="ms"
|
||||
)
|
||||
|
||||
res = model.export(type="onnx", quantize=False, opset_version=13, device='cpu') # fp32 onnx-gpu
|
||||
# res = model.export(type="onnx_fp16", quantize=False, opset_version=13, device='cuda') # fp16 onnx-gpu
|
||||
@ -1,3 +1,4 @@
|
||||
import logging
|
||||
import os
|
||||
import json
|
||||
from omegaconf import OmegaConf, DictConfig
|
||||
@ -79,7 +80,10 @@ def download_from_ms(**kwargs):
|
||||
kwargs["jieba_usr_dict"] = os.path.join(model_or_path, "jieba_usr_dict")
|
||||
if isinstance(kwargs, DictConfig):
|
||||
kwargs = OmegaConf.to_container(kwargs, resolve=True)
|
||||
if os.path.exists(os.path.join(model_or_path, "requirements.txt")):
|
||||
logging.warning(f'trust_remote_code: {kwargs.get("trust_remote_code", False)}')
|
||||
if os.path.exists(os.path.join(model_or_path, "requirements.txt")) and kwargs.get(
|
||||
"trust_remote_code", False
|
||||
):
|
||||
requirements = os.path.join(model_or_path, "requirements.txt")
|
||||
print(f"Detect model requirements, begin to install it: {requirements}")
|
||||
from funasr.utils.install_model_requirements import install_requirements
|
||||
|
||||
@ -84,4 +84,4 @@ def export_dynamic_axes(self):
|
||||
def export_name(
|
||||
self,
|
||||
):
|
||||
return "model"
|
||||
return "model.onnx"
|
||||
|
||||
@ -1 +1 @@
|
||||
1.2.6
|
||||
1.2.7
|
||||
Loading…
Reference in New Issue
Block a user