File size: 371 Bytes
5fa1a76
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
def preprocess_function(examples):
     audio_arrays = [x["array"] for x in examples["audio"]]
     inputs = feature_extractor(
         audio_arrays, sampling_rate=feature_extractor.sampling_rate, max_length=16000, truncation=True
     )
     return inputs

To apply the preprocessing function over the entire dataset, use 🤗 Datasets [~datasets.Dataset.map] function.