File size: 535 Bytes
752ce9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from dataset import Dataset
from model import Models


def data(dataset):
    for i, item in enumerate(dataset):
        yield {**item["audio"], "reference": item["norm_text"]}


def streamed_infernce(dataset, pipeline):
    

    # placeholders for predictions and references
    predictions = []
    references = []

    # run streamed inference
    for out in pipeline(data(dataset), batch_size=16):
        predictions.append(pipeline(out["text"]))
        references.append(out["reference"][0])

    return predictions, references