Hi!
I created a dataset from a folder with some mp3 files and tried to iterate over them with KeyDataset:
import datasets
from transformers import pipeline
from transformers.pipelines.pt_utils import KeyDataset
from tqdm.auto import tqdm
dataset_mp3 = load_dataset("audiofolder", data_dir="/content/drive/MyDrive/Temp/Mp3", drop_metadata=True).cast_column("audio", Audio(sampling_rate=16000))
# KeyDataset (only *pt*) will simply return the item in the dict returned by the dataset item
# as we're not interested in the *target* part of the dataset. For sentence pair use KeyPairDataset
for out in tqdm(pipe(KeyDataset(dataset_mp3["train"], "audio"))):
print(out)
# {"text": "My audio transcription"}
# {"text": ....}
# ....
For now I’m getting the output for the processing I want (“text”), but how to get the file path corresponding to each output?
P.S: I’m using Google Colab.
Thanks!