🚀 語音識別模型
本項目是一個語音識別模型,通過合併多個基礎模型,使用特定的合併方法和參數,實現對俄語語音的自動識別。該模型可與簡單的OpenAI兼容API服務器結合使用,同時提供了使用示例代碼,方便開發者進行語音識別任務。
🚀 快速開始
本模型使用TIES合併方法進行合併。以下是合併時使用的配置:
method: ties
parameters:
ties_density: 0.9
encoder_weights:
- 0.8
- 0.2
decoder_weights:
- 0.2
- 0.8
models:
model_a: "/mnt/cloud/llm/whisper/whisper-large-v3-russian"
model_b: "/mnt/cloud/llm/whisper/whisper-large-v3-ru-podlodka"
output_dir: "/mnt/cloud/llm/whisper/whisper-large-v3-russian-ties-podlodka"
✨ 主要特性
- 多基礎模型合併:基於
antony66/whisper-large-v3-russian
和bond005/whisper-large-v3-ru-podlodka
兩個基礎模型進行合併。
- 支持俄語識別:適用於俄語語音的自動識別任務。
- 可與API服務器集成:能與簡單的OpenAI兼容API服務器結合使用,如whisper-api-server 。
📦 安裝指南
文檔未提及具體安裝步驟,可參考相關模型庫(如transformers
)的官方文檔進行安裝。
💻 使用示例
基礎用法
在處理電話通話語音時,強烈建議在進行自動語音識別(ASR)之前對錄音進行預處理並調整音量。例如,可以使用以下命令:
sox record.wav -r 8000 record-normalized.wav norm -0.5 compand 0.3,1 -90,-90,-70,-50,-40,-15,0,0 -7 0 0.15
然後,使用以下Python代碼進行語音識別:
import torch
from transformers import WhisperForConditionalGeneration, WhisperProcessor, pipeline
torch_dtype = torch.bfloat16
device = 'cpu'
if torch.cuda.is_available():
device = 'cuda'
elif torch.backends.mps.is_available():
device = 'mps'
setattr(torch.distributed, "is_initialized", lambda : False)
device = torch.device(device)
whisper = WhisperForConditionalGeneration.from_pretrained(
"antony66/whisper-large-v3-russian", torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True,
)
processor = WhisperProcessor.from_pretrained("antony66/whisper-large-v3-russian")
asr_pipeline = pipeline(
"automatic-speech-recognition",
model=whisper,
tokenizer=processor.tokenizer,
feature_extractor=processor.feature_extractor,
max_new_tokens=256,
chunk_length_s=30,
batch_size=16,
return_timestamps=True,
torch_dtype=torch_dtype,
device=device,
)
from io import BufferIO
wav = BytesIO()
with open('record-normalized.wav', 'rb') as f:
wav.write(f.read())
wav.seek(0)
asr = asr_pipeline(wav, generate_kwargs={"language": "russian", "max_new_tokens": 256}, return_timestamps=False)
print(asr['text'])
📚 詳細文檔
模型信息
屬性 |
詳情 |
基礎模型 |
antony66/whisper-large-v3-russian、bond005/whisper-large-v3-ru-podlodka |
語言 |
俄語 |
庫名稱 |
transformers |
標籤 |
asr、whisper、russian、mergekit、merge |
數據集 |
mozilla-foundation/common_voice_17_0、bond005/taiga_speech_v2、bond005/podlodka_speech、bond005/rulibrispeech |
評估指標 |
wer |
簡單API服務器
該模型可以與簡單的OpenAI兼容API服務器結合使用,具體可參考:whisper-api-server
🔧 技術細節
本模型處於開發進行中(WIP)狀態,目標是儘可能對其進行微調,以用於電話通話的語音識別。如果您想參與貢獻,並且知道或擁有任何優質數據集,請告知。非常感謝您的幫助。