Views
No views yet
@inproceedings{lehecka24_interspeech,
title = {A Comparative Analysis of Bilingual and Trilingual Wav2Vec Models for Automatic Speech Recognition in Multilingual Oral History Archives},
author = {Jan Lehečka and Josef V. Psutka and Lubos Smidl and Pavel Ircing and Josef Psutka},
year = {2024},
booktitle = {Interspeech 2024},
pages = {1285--1289},
doi = {10.21437/Interspeech.2024-472},
issn = {2958-1796},
}1from transformers import Wav2Vec2Model, Wav2Vec2FeatureExtractor
2import torchaudio
3
4feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("fav-kky/wav2vec2-base-cs-de-100k")
5model = Wav2Vec2Model.from_pretrained("fav-kky/wav2vec2-base-cs-de-100k")
6
7speech_array, sampling_rate = torchaudio.load("/path/to/audio/file.wav")
8inputs = feature_extractor(
9 speech_array,
10 sampling_rate=16_000,
11 return_tensors="pt"
12)["input_values"][0]
13
14output = model(inputs)
15embeddings = output.last_hidden_state.detach().numpy()[0]