如何为 OpenAI 的 Whisper ASR 提供​​一些提示短语?

Fra*_*urt 5 python speech-recognition openai-api openai-whisper hint-phrases

我使用 OpenAI 的Whisper python 库进行语音识别。我如何给出一些提示短语,就像使用其他 ASR(例如Google)可以完成的那样?


使用 OpenAI 的Whisper进行转录(在 Ubuntu 20.04 x64 LTS 上使用 Nvidia GeForce RTX 3090 进行测试):

conda create -y --name whisperpy39 python==3.9
conda activate whisperpy39
pip install git+https://github.com/openai/whisper.git 
sudo apt update && sudo apt install ffmpeg
whisper recording.wav
whisper recording.wav --model large
Run Code Online (Sandbox Code Playgroud)

如果使用 Nvidia GeForce RTX 3090,请在后面添加以下内容conda activate whisperpy39

pip install -f https://download.pytorch.org/whl/torch_stable.html
conda install pytorch==1.10.1 torchvision torchaudio cudatoolkit=11.0 -c pytorch
Run Code Online (Sandbox Code Playgroud)

Fra*_*urt 7

提示短语/增强的 2 个潜在位置:

\n
    \n
  1. https://github.com/openai/whisper/blob/15ab54826343c27cfaf44ce31e9c8fb63d0aa775/whisper/decoding.py#L87-L88:在 prompt( 而不是在 中添加提示短语prefix:请参阅vs.上的讨论。有一个新的\xc2 \xa0option 自提交 2037b65以来:promptprefix --initial_prompt

    \n
    whisper audio.mp3 --initial\\_prompt "So we were just talking about DALL\xc2\xb7E"\n
    Run Code Online (Sandbox Code Playgroud)\n
  2. \n
  3. https://github.com/openai/whisper/blob/15ab54826343c27cfaf44ce31e9c8fb63d0aa775/whisper/decoding.py#L302:更改代码以增加包含提示短语的序列的可能性,例如

    \n
    \n

    目前除了提供类似上面的内容之外,没有其他接口initial_prompt;你可以用logit 偏差来破解一些东西,这有效地提高了某些标记的预测概率。该类旨在支持这一点LogitFilter

    \n
    \n
  4. \n
\n

我不知道它的效率如何。另外,当提示词不在词典中时,就会出现一个潜在的问题,在这种情况下,需要将提示词添加到词典中,这可能很困难。

\n