mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
update scripts
This commit is contained in:
parent
22e51ec95f
commit
0f1247d7a8
@ -12,17 +12,17 @@ model = AutoModel(
|
||||
device="cpu",
|
||||
)
|
||||
|
||||
res = model.export(type="onnx", quantize=False)
|
||||
res = model.export(type="torchscripts", quantize=False)
|
||||
print(res)
|
||||
|
||||
|
||||
# method2, inference from local path
|
||||
from funasr import AutoModel
|
||||
# # method2, inference from local path
|
||||
# from funasr import AutoModel
|
||||
|
||||
model = AutoModel(
|
||||
model="/Users/zhifu/.cache/modelscope/hub/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch",
|
||||
device="cpu",
|
||||
)
|
||||
# model = AutoModel(
|
||||
# model="/Users/zhifu/.cache/modelscope/hub/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch",
|
||||
# device="cpu",
|
||||
# )
|
||||
|
||||
res = model.export(type="onnx", quantize=False)
|
||||
print(res)
|
||||
# res = model.export(type="onnx", quantize=False)
|
||||
# print(res)
|
||||
|
||||
@ -22,6 +22,7 @@ def export(model, data_in=None, quantize: bool = False, opset_version: int = 14,
|
||||
)
|
||||
elif type == 'torchscripts':
|
||||
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
||||
print("Exporting torchscripts on device {}".format(device))
|
||||
_torchscripts(
|
||||
m,
|
||||
path=export_dir,
|
||||
|
||||
@ -7,7 +7,7 @@ def time_stamp_lfr6_onnx(us_cif_peak, char_list, begin_time=0.0, total_offset=-1
|
||||
START_END_THRESHOLD = 5
|
||||
MAX_TOKEN_DURATION = 30
|
||||
TIME_RATE = 10.0 * 6 / 1000 / 3 # 3 times upsampled
|
||||
cif_peak = us_cif_peak.reshape(-1)
|
||||
cif_peak = us_cif_peak.reshape(-1).cpu()
|
||||
num_frames = cif_peak.shape[-1]
|
||||
if char_list[-1] == "</s>":
|
||||
char_list = char_list[:-1]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user