/ Модель

Характеристики

Параметры
456 млн
Лицензия
Apache 2.0
Архитектура
whisper · dense
Базовая модель
whisper-medium
Библиотека
transformers
Опубликована
14 фев 2025

kb-whisper-medium

Распознавание речиАудио → текст7 профессий

Дообученная на больших объёмах шведской речи версия Whisper Medium для её автоматической расшифровки в текст.

2 130скачиваний за 30 дней3лайкавеса обновлены27 авг 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Распознавание речи» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

KB-Whisper Medium — модель распознавания речи, выпущенная Национальной библиотекой Швеции (KBLab). Это дообученная версия Whisper Medium от OpenAI с 455,8 млн параметров, предназначенная прежде всего для расшифровки шведской речи в текст. Модель обучали в два этапа на более чем 50 000 часах шведской аудиозаписи с транскрипциями; для второго этапа применялись более строгие фильтры качества данных.

Модель предлагает варианты транскрипции с разной степенью подробности: стандартный, более компактный для субтитров и более дословный. Авторы сообщают о снижении WER на шведской речи относительно OpenAI Whisper, однако приведённые в карточке таблицы неполны, поэтому оценить результаты именно версии Medium по ним нельзя. Доступны реализации и веса для Hugging Face, ONNX и CTranslate2, а также отдельные варианты для whisper.cpp.

Модель принимает аудио и генерирует текстовую транскрипцию. Карточка указывает шведский язык; сведений о контекстном окне нет. Распространяется по лицензии Apache-2.0.

Сценарии применения

  • транскрибация шведских аудиозаписей
  • создание субтитров к видео на шведском языке
  • подготовка более дословных расшифровок шведской речи
  • распознавание речи в шведских выступлениях и заседаниях

Ограничения

Модель специально обучена для шведской речи, поэтому её качество на других языках не установлено. Опубликованные в README таблицы результатов неполны и не позволяют проверить показатели версии Medium.

Для каких профессий подходит7

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

KB-Whisper Medium

The National Library of Sweden releases a new suite of Whisper models trained on over 50,000 hours of Swedish speech. In evaluations across FLEURS, CommonVoice and NST, our best performing model reduces the Word Error Rate (WER) by an average of 47% compared to OpenAI's whisper-large-v3. The performance of smaller Whisper model sizes on Swedish speech has also substantially improved, with kb-whisper-small outperforming openai/whisper-large-v3 (a model six times its size).

Model sizeFLEURSCommonVoiceNST
tinyKBLab13.212.911.2
OpenAI59.267.885.2
baseKBLab9.18.77.8
OpenAI39.652.153.4
smallKBLab7.36.46.6
OpenAI20.626.426.4
mediumKBLab6.65.45.8
OpenAI12.115.817.1
large-v3KBLab5.44.15.2
OpenAI7.89.511.3

Table: Word Error Rate (WER) comparison between KBLab's Whisper models and the corresponding OpenAI versions.

Usage

We provide checkpoints in different formats: Hugging Face, whisper.cpp (GGML), onnx, and ctranslate2 (used in faster-whisper and WhisperX).

2025-05-13 Update!

The default when loading our models through Hugging Face is Stage 2. As of May 2025 there exists one Stage 2 version in addition to the default Strict that specify the transcription style. By specifying revision="subtitle" in .from_pretrained() the model version with a more condensed style of transcribing is accessed. By specifying revision="strict" in .from_pretrained() the more verbatim-like version of the model is accessed. Below is an example of how this argument is passed in the .from_pretrained() function

import torch
from datasets import load_dataset
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline

device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
model_id = "KBLab/kb-whisper-medium"
model = AutoModelForSpeechSeq2Seq.from_pretrained(
    model_id, torch_dtype=torch_dtype, use_safetensors=True, cache_dir="cache", revision="strict"
)

The verbosity of the transcription styles of the three model versions ranges from the least verbose Stage 2 (default) to the most verbose Strict.

Hugging Face

Inference example for using KB-Whisper with Hugging Face:

import torch
from datasets import load_dataset
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline

device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
model_id = "KBLab/kb-whisper-medium"

model = AutoModelForSpeechSeq2Seq.from_pretrained(
    model_id, torch_dtype=torch_dtype, use_safetensors=True, cache_dir="cache"
)
model.to(device)
processor = AutoProcessor.from_pretrained(model_id)

pipe = pipeline(
    "automatic-speech-recognition",
    model=model,
    tokenizer=processor.tokenizer,
    feature_extractor=processor.feature_extractor,
    torch_dtype=torch_dtype,
    device=device,
)

generate_kwargs = {"task": "transcribe", "language": "sv"}
# Add return_timestamps=True for output with timestamps
res = pipe("audio.mp3", 
           chunk_length_s=30,
           generate_kwargs={"task": "transcribe", "language": "sv"})
print(res)

Faster-whisper

Faster-whisper provides fast and efficient inference via a reimplementation of Whisper using ctranslate2.

#### faster-whisper model ####
from faster_whisper import WhisperModel

model_id = "KBLab/kb-whisper-medium"
model = WhisperModel(
    model_id,
    device="cuda",
    compute_type="float16",
    download_root="cache", # cache directory
    # condition_on_previous_text = False # Can reduce hallucinations if we don't use prompts
)

# Transcribe audio.wav (convert to 16khz mono wav first via ffmpeg)
segments, info = model.transcribe("audio.wav", condition_on_previous_text=False)
print("Detected language '%s' with probability %f" % (info.language, info.language_probability))

for segment in segments:
    print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))

WhisperX

WhisperX provides a convenient method of getting accurate word level timestamps. The library combines (force aligns) the text output of Whisper with the accurate timestamps of Wav2vec2. We provide an example below of how to use KB-Whisper together with KBLab/wav2vec2-large-voxrex-swedish.

import whisperx

device = "cuda"
audio_file = "audio.wav"
batch_size = 16  # reduce if low on GPU mem
compute_type = "float16"  # change to "int8" if low on GPU mem (may reduce accuracy)

# 1. Transcribe with original whisper (batched)
model = whisperx.load_model(
    "KBLab/kb-whisper-medium", device, compute_type=compute_type, download_root="cache"  # cache_dir
)

audio = whisperx.load_audio(audio_file)
result = model.transcribe(audio, batch_size=batch_size)
print(result["segments"])  # before alignment

# delete model if low on GPU resources
# import gc; gc.collect(); torch.cuda.empty_cache(); del model

# 2. Align whisper output
model_a, metadata = whisperx.load_align_model(
    language_code=result["language"],
    device=device,
    model_name="KBLab/wav2vec2-large-voxrex-swedish",
    model_dir="cache",  # cache_dir
)
result = whisperx.align(
    result["segments"], model_a, metadata, audio, device, return_char_alignments=False
)

print(result["segments"])  # word level timestamps after alignment

Whisper.cpp / GGML

We provide GGML checkpoints used in the apps whisper.cpp and MacWhisper. To use our model with whisper.cpp first clone the repository and build the library:

git clone https://github.com/ggerganov/whisper.cpp.git
cd whisper.cpp
cmake -B build
cmake --build build --config Release

To use the model you need to download one of the GGML checkpoints we have uploaded. You can either press the download buttons here, or download using wget:

wget https://huggingface.co/KBLab/kb-whisper-medium/resolve/main/ggml-model-q5_0.bin # Quantized version
# wget https://huggingface.co/KBLab/kb-whisper-medium/resolve/main/ggml-model.bin # Non-quantized version

Run inference by specifying the model path after the argument -m, along with the path to the audio file as the last positional argument.

./build/bin/whisper-cli -m ggml-model-q5_0.bin ../audio.wav

onnx (optimum) and transformers.js usage

You can use the onnx checkpoints via Hugging Face's optimum library in the following manner:

from optimum.onnxruntime import ORTModelForSpeechSeq2Seq
from transformers import AutoProcessor

model_id = "KBLab/kb-whisper-medium"
processor = AutoProcessor.from_pretrained(model_id, cache_dir="cache")
model = ORTModelForSpeechSeq2Seq.from_pretrained(
    model_id,
    cache_dir="cache",
    subfolder="onnx",
)

import soundfile as sf
audio = sf.read("audio.wav")

inputs = processor.feature_extractor(audio[0], sampling_rate=16000, return_tensors="pt")
gen_tokens = model.generate(**inputs, max_length=300)
processor.decode(gen_tokens[0], skip_special_tokens=True)

An example of an app that runs inference locally in the browser with transformers.js and KB-Whisper can be found at https://whisper.mesu.re/ (created by Pierre Mesure). A template for setting up such an app with javascript can be found at https://github.com/xenova/whisper-web.

Training data

Our models have been trained on over 50,000 hours of Swedish audio with text transcriptions. The models were trained in 2 stages, each characterized by the application of different quality filters and thresholds for said filters.

Stage 1 employed low threshold values (0 to 0.30 BLEU depending on dataset), whereas Stage 2 used stricter thresholds (BLEU >= 0.7, weighted ROUGE-N >= 0.7, CER of first and last 10 characters <= 0.2).

DatasetContinued pretraining (h) -- Stage 1Finetuning (h) -- Stage 2
Subtitles34,2613,110
Riksdag21,9495,119
ISOF5454
NST250250
Total56,5148,533

The default when loading our models through Hugging Face is Stage 2. We have however also uploaded continued pretraining checkpoints and tagged them. You can load these other checkpoints by specifying the revision in .from_pretrained(). The pretrained checkpoints tag can for example be found here: pretrained-checkpoint. The Stage 2 default model tag is named standard. We supply two different stage 2 checkpoints -- one with a more condensed style of transcribing -- under the name subtitle, and one more verbose called strict.

Evaluation

WER compared to OpenAI

Model sizeFLEURSCommonVoiceNST
tinyKBLab13.212.911.2
OpenAI59.267.885.2
baseKBLab9.18.77.8
OpenAI39.652.153.4
smallKBLab7.36.46.6
OpenAI20.626.426.4
mediumKBLab6.65.45.8
OpenAI12.115.817.1
large-v3KBLab5.44.15.2
OpenAI7.89.511.3

WER for different KBLab stage2 versions

Model sizeFLEURSCommonVoiceNST
tinystandard13.212.911.2
strict14.113.411.0
subtitle13.312.911.4
basestandard9.18.77.8
strict10.49.68.4
subtitle9.18.77.9
smallstandard7.36.46.6
strict8.27.06.7
subtitle7.36.46.6
mediumstandard6.65.45.8
strict6.85.46.0
large-v3standard5.44.15.2
strict5.34.05.1
subtitle5.34.15.3

BLEU Score compared to OpenAI

Model sizeFLEURSCommonVoiceNST
tinyKBLab76.673.774.3
OpenAI26.921.124.0
baseKBLab83.279.978.3
OpenAI41.132.536.9
smallKBLab86.683.579.6
OpenAI64.056.558.2
mediumKBLab87.685.080.2
OpenAI77.170.168.9
large-v3KBLab89.887.281.1
OpenAI84.979.175.1

BLEU Score for different KBLab stage2 versions

Model sizeFLEURSCommonVoiceNST
tinystandard76.673.774.3
strict75.372.974.6
subtitle76.673.774.1
basestandard83.279.978.3
strict81.078.477.5
subtitle83.279.878.2
smallstandard86.683.579.6
strict84.982.479.3
subtitle86.683.579.6
mediumstandard87.685.080.2
strict87.384.980.1
large-v3standard89.887.281.1
strict90.087.481.2
subtitle89.887.381.0

Acknowledgements

We acknowledge the EuroHPC Joint Undertaking for awarding this project access to the EuroHPC supercomputer LEONARDO, hosted by CINECA (Italy) and the LEONARDO consortium through an EuroHPC AI and Data-Intensive Applications Access call.

Citation

KB-Whisper is a product of KBLab of the National Library of Sweden. Key contributors include Faton Rekathati, Justyna Sikora, Robin Kurtz, Agnes Toftgård, and Leonora Vesterbacka, under the direction of Love Börjeson.
Please refer to the following paper if you want to cite our work with KB-Whisper.

Vesterbacka, L., Rekathati, F., Kurtz, R., Sikora, J., Toftgård, A. (2025) Swedish Whispers; Leveraging a Massive Speech Corpus for Swedish Speech Recognition. Proc. Interspeech 2025, 758-762, doi: 10.21437/Interspeech.2025-2646

Bibtex citation:

@inproceedings{vesterbacka25_interspeech,
  title     = {{Swedish Whispers; Leveraging a Massive Speech Corpus for Swedish Speech Recognition}},
  author    = {{Leonora Vesterbacka and Faton Rekathati and Robin Kurtz and Justyna Sikora and Agnes Toftgård}},
  year      = {{2025}},
  booktitle = {{Interspeech 2025}},
  pages     = {{758--762}},
  doi       = {{10.21437/Interspeech.2025-2646}},
  issn      = {{2958-1796}},
}

You can find our Interspeech 2025 article here, and the arXiv preprint here.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Можно запустить

Подбираем GPU…

Класс архитектуры
WhisperForConditionalGeneration
Ревизия весов
0abe10b

0 моделей