概要

使用方法

from transformers import pipeline
from pathlib import Path

pipe = pipeline(
    "automatic-speech-recognition",
    model="Parakeet-Inc/furigana_whisper_small_jsut",
)

def transcribe_with_prompt(pipe, audio_path: str | Path, prompt: str) -> str:
    prompt_ids = pipe.tokenizer.get_prompt_ids(
        prompt, return_tensors="pt"
    ).to(pipe.device)
    generate_kwargs = {"prompt_ids": prompt_ids}
    result = pipe(str(audio_path), generate_kwargs=generate_kwargs)
    return result["text"]

# 実行例
audio_path = "path/to/your/audio.wav"
prompt = "明日は晴れ。"
transcription = transcribe_with_prompt(pipe, audio_path, prompt)
print(transcription)  # アスワハレ。

注意

  • 音声の長さは30秒以下でないとうまく動きません。
  • 公開しているsmallモデルはそこまで精度が良いとは言えず、G2Pマッチ率(データセットに対してフィルタリングを行った後に残るデータ量)が40%程度となっています。より精度の高いモデルを使いたい方はデータを揃え、ベースモデルもwhisper-smallより大きいモデルにして自分で学習を行うことをおすすめします。
  • 学習データでのプロンプトは、全て「句読点が、。のみ」「最後に必ず。が付く」と正規化されています。よって、与えるプロンプトも同様の形式にしたほうが精度が高くなります。
Downloads last month
0
Safetensors
Model size
242M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Parakeet-Inc/furigana_whisper_small_jsut

Finetuned
(2744)
this model

Space using Parakeet-Inc/furigana_whisper_small_jsut 1