模型概述
模型特點
模型能力
使用案例
🚀 CrisperWhisper
CrisperWhisper是OpenAI的Whisper的高級變體,專為快速、精確且逐字的語音識別而設計,能提供準確的詞級時間戳。
🔗 相關鏈接
- 查看我們的集合:所有TTS模型上傳
- 學習微調TTS模型:閱讀我們的指南
- 瞭解Unsloth Dynamic 2.0:Unsloth Dynamic 2.0
🌟 Unsloth支持的模型
Unsloth支持的模型 | 免費筆記本 | 性能 | 內存使用 |
---|---|---|---|
Orpheus-TTS | ▶️ 在Colab上開始 | 快1.5倍 | 減少58% |
Whisper Large V3 | ▶️ 在Colab上開始 | 快1.5倍 | 減少50% |
Qwen3 (14B) | ▶️ 在Colab上開始 | 快2倍 | 減少70% |
Llama 3.2 Vision (11B) | ▶️ 在Colab上開始 | 快1.8倍 | 減少50% |
🔍 模型信息
屬性 | 詳情 |
---|---|
許可證 | cc-by-nc-4.0 |
基礎模型 | openai/whisper-large-v3、nyrahealth/CrisperWhisper |
評估指標 | cer、wer |
任務類型 | automatic-speech-recognition |
庫名稱 | transformers |
🚀 快速開始
CrisperWhisper是OpenAI的Whisper的高級變體,旨在實現快速、精確且逐字的語音識別,並提供準確(清晰)的詞級時間戳。與原始的Whisper不同,原始Whisper傾向於省略不流暢的表達,更遵循一種預期的轉錄風格,而CrisperWhisper旨在準確轉錄每一個 spoken word,包括填充詞、停頓、結巴和錯誤開頭。更多詳情請查看我們的倉庫:https://github.com/nyrahealth/CrisperWhisper
✨ 主要特性
- 🎯 準確的詞級時間戳:通過在訓練期間使用調整後的分詞器和自定義注意力損失,即使在不流暢和停頓處也能提供精確的時間戳。
- 📝 逐字轉錄:準確轉錄每一個 spoken word,包括並區分填充詞,如“um”和“uh”。
- 🔍 填充詞檢測:檢測並準確轉錄填充詞。
- 🛡️ 幻覺緩解:最大限度地減少轉錄幻覺,提高準確性。
📚 詳細文檔
🏆 亮點
- 在OpenASR排行榜的逐字數據集(TED、AMI)中獲得第一名。
- 被INTERSPEECH 2024接收。
- 論文發佈:查看我們的論文,瞭解我們調整分詞器的詳細信息和原因。
- ✨ 新特性:論文中未提及的是添加了注意力損失,以進一步提高時間戳的準確性。通過專門為使用時間戳數據進行DTW對齊的注意力分數添加損失,我們顯著提高了對齊性能。
1️⃣ 性能概述
1.1 定性性能概述
音頻 | Whisper Large V3 | Crisper Whisper |
---|---|---|
Demo de 1 | Er war kein Genie, aber doch ein fähiger Ingenieur. | Es ist zwar kein. Er ist zwar kein Genie, aber doch ein fähiger Ingenieur. |
Demo de 2 | Leider müssen wir in diesen schweren Zeiten auch unserem Tagesgeschäft nachgehen. Der hier vorgelegte Kulturhaushalt der Ampelregierung strebt an, den Erfolgskurs der Union zumindest fiskalisch fortzuführen. | Leider [UH] müssen wir in diesen [UH] schweren Zeiten auch [UH] unserem [UH] Tagesgeschäft nachgehen. Der hier [UH] vorgelegte [UH] Kulturhaushalt der [UH] Ampelregierung strebt an, den [UH] Erfolgskurs der Union [UH] zumindest [UH] fiskalisch fortzuführen. Es. |
Demo de 3 | die über alle FRA-Fraktionen hinweg gut im Blick behalten sollten, auch weil sie teilweise sehr teeteuer sind. Aber nicht nur, weil sie teeteuer sind. Wir steigen mit diesem Endentwurf ein in die sogenannten Pandemie-Bereitschaftsverträge. | Die über alle Fr Fraktionen hinweg gut im [UH] Blick behalten sollten, auch weil sie teil teilweise sehr te teuer sind. Aber nicht nur, weil sie te teuer sind. Wir [UH] steigen mit diesem Ent Entwurf ein in die sogenannten Pand Pandemiebereitschaftsverträge. |
Demo en 1 | alternative is you can get like, you have those Dr. Bronner's | Alternative is you can get like [UH] you have those, you know, those doctor Brahmer's. |
Demo en 2 | influence our natural surrounding? How does it influence our ecosystem? | Influence our [UM] our [UH] our natural surrounding. How does it influence our ecosystem? |
Demo en 3 | and always find a place on the street to park and it was easy and you weren't a long distance away from wherever it was that you were trying to go. So I remember that being a lot of fun and easy to do and there were nice places to go and good events to attend. Come downtown and you had the Warner Theater and | And always find a place on the street to park. And and it was it was easy and you weren't a long distance away from wherever it was that you were trying to go. So, I I I remember that being a lot of fun and easy to do and there were nice places to go and, [UM] i good events to attend. Come downtown and you had the Warner Theater and, [UM] |
Demo en 4 | you know, more masculine, who were rough, and that definitely wasn't me. Then, you know, I was very smart because my father made sure I was smart, you know. So, you know, I hung around those people, you know. And then you had the ones that were just out doing things that they shouldn't have been doing also. So, yeah, I was in the little geek squad. You were in the little geek squad. Yeah. | you know, more masculine, who were rough, and that definitely wasn't me. Then, you know, I was very smart because my father made sure I was smart. You know, so, [UM] you know, I I hung around those people, you know. And then you had the ones that were just just out doing things that they shouldn't have been doing also. So yeah, I was the l I was in the little geek squad. Do you |
1.2 定量性能概述
轉錄性能
CrisperWhisper在轉錄性能上顯著優於Whisper Large v3,尤其是在真實標籤採用逐字轉錄風格的數據集上,如AMI和TED-LIUM。
數據集 | CrisperWhisper | Whisper Large v3 |
---|---|---|
AMI | 8.72 | 16.01 |
Earnings22 | 12.37 | 11.3 |
GigaSpeech | 10.27 | 10.02 |
LibriSpeech clean | 1.74 | 2.03 |
LibriSpeech other | 3.97 | 3.91 |
SPGISpeech | 2.71 | 2.95 |
TED-LIUM | 3.35 | 3.9 |
VoxPopuli | 8.61 | 9.52 |
CommonVoice | 8.19 | 9.67 |
平均WER | 6.66 | 7.7 |
分割性能
CrisperWhisper在分割性能上表現出色,尤其是在不流暢和停頓處的性能差距更為明顯。
數據集 | 指標 | CrisperWhisper | Whisper Large v2 | Whisper Large v3 |
---|---|---|---|---|
AMI IHM | F1 Score | 0.79 | 0.63 | 0.66 |
Avg IOU | 0.67 | 0.54 | 0.53 | |
Common Voice | F1 Score | 0.80 | 0.42 | 0.48 |
Avg IOU | 0.70 | 0.32 | 0.43 | |
TIMIT | F1 Score | 0.69 | 0.40 | 0.54 |
Avg IOU | 0.56 | 0.32 | 0.43 |
💻 使用示例
基礎用法
首先安裝我們的自定義transformers分支,以獲得最準確的時間戳:
pip install git+https://github.com/nyrahealth/transformers.git@crisper_whisper
高級用法
import os
import sys
import torch
from datasets import load_dataset
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
def adjust_pauses_for_hf_pipeline_output(pipeline_output, split_threshold=0.12):
"""
Adjust pause timings by distributing pauses up to the threshold evenly between adjacent words.
"""
adjusted_chunks = pipeline_output["chunks"].copy()
for i in range(len(adjusted_chunks) - 1):
current_chunk = adjusted_chunks[i]
next_chunk = adjusted_chunks[i + 1]
current_start, current_end = current_chunk["timestamp"]
next_start, next_end = next_chunk["timestamp"]
pause_duration = next_start - current_end
if pause_duration > 0:
if pause_duration > split_threshold:
distribute = split_threshold / 2
else:
distribute = pause_duration / 2
# Adjust current chunk end time
adjusted_chunks[i]["timestamp"] = (current_start, current_end + distribute)
# Adjust next chunk start time
adjusted_chunks[i + 1]["timestamp"] = (next_start - distribute, next_end)
pipeline_output["chunks"] = adjusted_chunks
return pipeline_output
device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
model_id = "nyrahealth/CrisperWhisper"
model = AutoModelForSpeechSeq2Seq.from_pretrained(
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
)
model.to(device)
processor = AutoProcessor.from_pretrained(model_id)
pipe = pipeline(
"automatic-speech-recognition",
model=model,
tokenizer=processor.tokenizer,
feature_extractor=processor.feature_extractor,
chunk_length_s=30,
batch_size=16,
return_timestamps='word',
torch_dtype=torch_dtype,
device=device,
)
dataset = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
sample = dataset[0]["audio"]
hf_pipeline_output = pipe(sample)
crisper_whisper_result = adjust_pauses_for_hf_pipeline_output(hf_pipeline_output)
print(crisper_whisper_result)
更多關於停頓分佈邏輯的原因,請閱讀我們的論文。
🔧 技術細節
實現方式
我們在Whisper的交叉注意力分數上採用了流行的動態時間規整(DTW)方法,詳情見我們的論文,以得出詞級時間戳。通過利用我們的重新分詞過程,這種方法使我們能夠一致地檢測停頓。鑑於時間戳的準確性在很大程度上取決於DTW成本矩陣,進而取決於交叉注意力的質量,我們為選定的對齊頭開發了一種專門的損失函數,以提高精度。
雖然由於在提交截止日期前無法完成實驗和訓練,這個損失函數未包含在原始論文中,但它已用於訓練我們公開可用的模型。該損失的主要特點如下:
-
數據準備
- 我們使用了帶有詞級時間戳註釋的數據集,如AMI IHM和TIMIT,但需要額外的時間戳數據。
- 為此,我們使用一個小的手動標註數據集驗證了幾個強制對齊工具的對齊準確性。
- 基於此驗證,我們選擇了PyTorch CTC對齊器從CommonVoice數據集中生成更多時間對齊的數據。
- 由於PyTorch CTC對齊器傾向於高估停頓持續時間,我們應用了我們論文中詳細描述的相同停頓分割方法來糾正這些錯誤。使用我們的手動標註數據集確認了這種糾正的有效性。
-
令牌 - 單詞對齊
- 由於我們論文中詳細描述的重新分詞,每個令牌要麼是一個單詞的一部分,要麼是一個停頓/空格,但絕不會兩者都是。
- 因此,每個令牌可以清晰地對齊到一個單詞或一個空格/停頓。
-
真實交叉注意力
- 我們將令牌的交叉注意力真實值定義為L2歸一化向量,其中:
- 值為1表示根據詞級真即時間戳,該單詞處於活動狀態。
- 值為0表示不應關注。
- 為了考慮真即時間戳中的小誤差,我們在真實向量的兩側應用4步(8毫秒)的線性插值,從0平滑過渡到1。
- 我們將令牌的交叉注意力真實值定義為L2歸一化向量,其中:
-
損失計算
- 損失函數定義為預測交叉注意力向量(預測令牌時)與真實交叉注意力向量之間的
1 - 餘弦相似度
。 - 該損失在所有預測令牌和對齊頭之間求平均值。
- 損失函數定義為預測交叉注意力向量(預測令牌時)與真實交叉注意力向量之間的
-
對齊頭選擇
- 為了選擇對齊頭,我們在帶時間戳的timit數據集上評估了每個單獨的解碼器注意力頭的對齊性能。
- 我們選擇了性能最好的15個頭,並使用我們的注意力損失對它們進行微調。
-
訓練細節
- 由於訓練期間我們的大多數樣本短於30秒,我們以50%的概率移動音頻樣本和相應的時間戳真實值,以減輕交叉注意力對編碼器輸出早期位置的“過擬合”。
- 如果我們有超過40毫秒的靜音(移動前後),我們在真實轉錄(和相應的交叉注意力真實值)前添加一個空格,以便模型必須準確預測第一個單詞的起始時間。
- 我們在訓練期間使用WavLM增強,向音頻波形添加隨機語音樣本或噪聲,以總體提高轉錄的魯棒性和對齊頭的穩定性。
- 我們將交叉注意力向量中屬於真實單詞前4秒和後4秒的“預測”值裁剪為0。這是為了降低交叉注意力向量的維度,從而在損失中強調重要的注意力,最終用於對齊。
- 以1%的概率,我們使用僅包含噪聲的樣本,模型必須返回空預測,以改善幻覺。
- 該模型在英語和德語數據集的混合上進行訓練,因此我們僅保證在這些語言上有良好的性能。
- 該模型分三個階段進行訓練,第一階段我們使用約10000小時的音頻來使Whisper適應新的分詞器。第二階段我們僅使用逐字轉錄的高質量數據集。最後,我們繼續在這個逐字混合數據集上訓練,並添加註意力損失進行另外6000步的訓練。
📄 許可證
本項目採用CC BY-NC 4.0許可證。



