question

#4
by kalinasviatoslav - opened

As I understand from the code it translates the array to text
but how is the array appear -> it's not placed in the dataset and just appears after load_dataset. Can you please provide example how to transcript my audio file
if it need to be transformed to array before passing to model please provide sample how

If you want to pass your audio to this demo
please use this code
import librosa

audio_path = "/Users/svyatoslavkalina/Desktop/Projects/cybearsoft/pythonProject1/new.m4a" # Replace with the actual path to your audio file

sampling_rate = 16000
waveform, _ = librosa.load(audio_path, sr=sampling_rate)

en_sample= waveform

inputs = processor(en_sample, sampling_rate=16_000, return_tensors="pt")

this is how MAgic Array appears

kalinasviatoslav changed discussion status to closed

You can simply pass the path to an audio file to pipeline and it will transcribe it for you:

from transformers import pipeline

model_id = "facebook/mms-1b-all"
pipe = pipeline(model=model_id, model_kwargs={"target_lang":"fra", "ignore_mismatched_sizes":True})

# load the French adapter weights
pipe.model.load_adapter("fra")

# transcribe an audio file
transcription = pipe(audio_path)

Sign up or log in to comment