MCPcopy Index your code
hub / github.com/modelscope/FunASR / main

Function main

tests_models/test_paraformer.py:6–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import time
5
6def main():
7 from funasr import AutoModel
8
9 print("[Paraformer] Loading model...")
10 t0 = time.time()
11 model = AutoModel(
12 model="iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch",
13 vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch",
14 vad_kwargs={"max_single_segment_time": 60000},
15 punc_model="iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch",
16 device="cpu",
17 disable_update=True,
18 )
19 print("[Paraformer] Model loaded in %.1fs" % (time.time()-t0))
20
21 print("[Paraformer] Running inference...")
22 t0 = time.time()
23 res = model.generate(
24 input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav",
25 cache={},
26 )
27 print("[Paraformer] Inference done in %.1fs" % (time.time()-t0))
28 print("[Paraformer] Result: %s" % res)
29
30 if res and len(res) > 0 and "text" in res[0]:
31 print("[Paraformer] PASSED")
32 return 0
33 else:
34 print("[Paraformer] FAILED - no text in result")
35 return 1
36
37if __name__ == "__main__":
38 sys.exit(main())

Callers 1

test_paraformer.pyFile · 0.70

Calls 2

generateMethod · 0.95
AutoModelClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…