Views
No views yet
1import torch
2import librosa
3from transformers import AutoModelForAudioClassification, AutoFeatureExtractor
4
5## Load an audio file
6audio_array, sr = librosa.load("path_to_audio.wav", sr=16000)
7
8## Load model and feature extractor
9model = AutoModelForAudioClassification.from_pretrained("alkiskoudounas/hubert-large-slurp")
10feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/hubert-large-ls960-ft")
11
12## Extract features
13inputs = feature_extractor(audio_array.squeeze(), sampling_rate=feature_extractor.sampling_rate, padding=True, return_tensors="pt")
14
15## Compute logits
16logits = model(**inputs).logits1@ARTICLE{koudounas2024taslp,
2 author={Koudounas, Alkis and Pastor, Eliana and Attanasio, Giuseppe and Mazzia, Vittorio and Giollo, Manuel and Gueudre, Thomas and Reale, Elisa and Cagliero, Luca and Cumani, Sandro and de Alfaro, Luca and Baralis, Elena and Amberti, Daniele},
3 journal={IEEE/ACM Transactions on Audio, Speech, and Language Processing},
4 title={Towards Comprehensive Subgroup Performance Analysis in Speech Models},
5 year={2024},
6 volume={32},
7 number={},
8 pages={1468-1480},
9 keywords={Analytical models;Task analysis;Metadata;Speech processing;Behavioral sciences;Itemsets;Speech;Speech representation;E2E-SLU models;subgroup identification;model bias analysis;divergence},
10 doi={10.1109/TASLP.2024.3363447}}