Whisper 调用方法

!pip install git+https://github.com/openai/whisper.git

!sudo apt update && sudo apt install ffmpeg



!whisper /content/drive/MyDrive/IPZZ-008.mp3 --language Japanese --model large-v2 --task translate --no_speech_threshold 0.7 --logprob_threshold None --compression_ratio_threshold 2.2



!whisper /content/drive/MyDrive/IPZZ-008.mp3 --language Japanese --model large-v2 --output_dir /content/drive/MyDrive/




no_speech_threshold参数设置为0.7或更高的值,以确保只有真正的对话被翻译,而其他噪音被过滤掉。


logprob_threshold参数,它控制了DeepScribe输出的每个单词的概率。较高的阈值值意味着只有概率超过该阈值的单词才会被输出,这可能会导致一些单词被忽略。较低的阈值会导致更多单词被输出,但也会增加错误输出的风险。因此,建议根据具体情况进行调整,一般建议将其设置为None,即不设置阈值。


compression_ratio_threshold参数,它控制了DeepScribe是否对音频进行压缩。较高的阈值值意味着只有压缩比例超过该阈值的音频才会被压缩,这可能会导致一些嘈杂的呻吟和嘀咕等杂音被保留下来。较低的阈值会导致更多音频被压缩,但也可能会影响音频质量。因此,建议根据具体情况进行调整,一般建议将其设置为2.0到2.5之间的值,以平衡压缩和音频质量之间的关系。