游雁
2024-06-08 df00f5fc0b9f61068df74349f6e001640931efc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved.
#  MIT License  (https://opensource.org/licenses/MIT)
 
from funasr import AutoModel
 
model = AutoModel(
    model="/nfs/beinian.lzr/workspace/GPT-4o/Exp/exp6/4m-8gpu/exp6_speech2text_0607_linear_ddp",
)
 
jsonl = (
    "/nfs/beinian.lzr/workspace/GPT-4o/Data/Speech2Text/TestData/aishell1_test_speech2text.jsonl"
)
 
with open(jsonl, "r") as f:
    lines = f.readlines()
 
for i, line in enumerate(lines):
    data_dict = json.loads(line.strip())
    data = data_dict["messages"]
 
    res = model.generate(
        input=data,
        cache={},
    )
 
    print(res)