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

Function run_pytorch

benchmark_vllm.py:89–109  ·  view source on GitHub ↗
(model_name, seg_files, device="cuda:0")

Source from the content-addressed store, hash-verified

87
88
89def run_pytorch(model_name, seg_files, device="cuda:0"):
90 from funasr import AutoModel
91
92 kwargs = {"model": model_name, "device": device, "disable_update": True}
93 if "Fun-ASR-Nano" in model_name:
94 kwargs["trust_remote_code"] = True
95 kwargs["remote_code"] = os.path.join(
96 os.path.dirname(__file__),
97 "examples/industrial_data_pretraining/fun_asr_nano/model.py"
98 )
99
100 model = AutoModel(**kwargs)
101 model.generate(input=seg_files[0]) # warmup
102
103 t0 = time.perf_counter()
104 texts = []
105 for f in seg_files:
106 res = model.generate(input=f)
107 texts.append(res[0]["text"])
108 t1 = time.perf_counter()
109 return t1 - t0, texts
110
111
112def run_vllm(model_name, seg_files, device="cuda:0", hub="ms"):

Callers 1

benchmark_vllm.pyFile · 0.85

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…