Yehor/openstt-uk
Updated • 23 • 1
How to use Yehor/w2v-bert-uk-v2.1 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("automatic-speech-recognition", model="Yehor/w2v-bert-uk-v2.1") # Load model directly
from transformers import AutoProcessor, AutoModelForCTC
processor = AutoProcessor.from_pretrained("Yehor/w2v-bert-uk-v2.1")
model = AutoModelForCTC.from_pretrained("Yehor/w2v-bert-uk-v2.1", device_map="auto")v2.1
See other Ukrainian models: https://github.com/egorsmkv/speech-recognition-uk
This is a next model of https://huggingface.co/Yehor/w2v-bert-uk
Use https://huggingface.co/spaces/Yehor/w2v-bert-uk-v2.1-demo space to see how the model works with your audios.
# pip install -U torch soundfile transformers
import torch
import soundfile as sf
from transformers import AutoModelForCTC, Wav2Vec2BertProcessor
# Config
model_name = 'Yehor/w2v-bert-uk-v2.1'
device = 'cuda:0' # or cpu
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
sampling_rate = 16_000
# Load the model
asr_model = AutoModelForCTC.from_pretrained(model_name, torch_dtype=torch_dtype).to(device)
processor = Wav2Vec2BertProcessor.from_pretrained(model_name)
paths = [
'sample1.wav',
]
# Extract audio
audio_inputs = []
for path in paths:
audio_input, _ = sf.read(path)
audio_inputs.append(audio_input)
# Transcribe the audio
inputs = processor(audio_inputs, sampling_rate=sampling_rate).input_features
features = torch.tensor(inputs).half().to(device)
with torch.inference_mode():
logits = asr_model(features).logits
predicted_ids = torch.argmax(logits, dim=-1)
predictions = processor.batch_decode(predicted_ids)
# Log results
print('Predictions:')
print(predictions)
@misc {smoliakov_2025,
author = { {Smoliakov} },
title = { w2v-bert-uk-v2.1 (Revision 094c59d) },
year = 2025,
url = { https://huggingface.co/Yehor/w2v-bert-uk-v2.1 },
doi = { 10.57967/hf/4554 },
publisher = { Hugging Face }
}
Base model
facebook/w2v-bert-2.0