安装方式不变,转录语音时指定使用模型为turbo即可。下面使用命令行对一段访谈音频进行转录(音频取自哔哩哔哩)。 whisper Av113474277477413.mp3 --language Chinese --model turbo--device cuda:0 --initial_prompt "以下是普通话的句子" 1.会先下载turbo模型,1.51G左右 2.顺利开始转录。 3.查看资源占用情况。转录...
我们可以通过 initial_prompt 参数提升 Whisper 语音生成文字的质量,使用这个参数,模型会尝试尽量匹配提示的样式。 importwhisperimportarrow# 定义模型、音频地址、录音开始时间defexcute(model_name,file_path,start_time,initial_prompt): model = whisper.load_model(model_name) result = model.transcribe(file_path,...
whisper music.mp3 --model tiny --language Chinese --device cuda:0 --initial_prompt "以下是普通话的句子" 1. 2. 3. 4. 5. Python代码 import whisper model = whisper.load_model("base", "cpu") mps_path = r"music.mp3" result = model.transcribe(mps_path, fp16=False, language='Chinese'...
此外,针对第一个转写窗口,你也能提供initial_prompt,比如“这是一段演讲,里面会提到大数据和ChatGPT是如何结合的”,你可以通过prompt引导提高特定场景和术语下的语音识别表现,这点就很openAI了。 使用prompt时要注意:如果你用model.transcribe(),就用initial_prompt,如果你用whisper.decode(),就在options用prompt,两边...
wav --language Chinese --model medium --initial_prompt "以下是普通话的句子。" 注意:由于whisper的默认输出可能是繁体中文,因此需要通过--initial_prompt参数指定输出简体中文。 批量音频文件识别:如果需要处理大量音频文件,可以使用Python脚本进行批量处理。以下是一个简单的示例脚本: import whisper import os model...
4.initial_prompt:应该是类似于chatgpt的prompt吧,但是感觉没什么需要填写的必要。 5.word_timestamps:单词级别的时间戳。在输出格式为json时起作用,会输出每个单词的开始时间、结束时间、识别正确的可能性。 6.output:输出格式。 txt:文本格式。 vtt、srt:字幕格式,可以给视频制作字幕。
- initial_prompt: 初始提示,默认为None - word_timestamps: 是否返回单词时间戳,默认为False - prepend_punctuations: 前缀标点符号,默认为"\"'“¿([{-" - append_punctuations: 后缀标点符号,默认为"\"'.。,,!!??::”)]}、" - **decode_options: 其他解码选项 ...
Related to #637. Add initial_prompt so we can avoid some re-implement of prompt_tokens and n_prompt_tokens. This changes removes the print of prompt tokens because it may not ideal in whisper_full.
其中,音频转文字接口,识别出的文字可能是简体,繁体混合的,可以通过参数initial_prompt调节,比如设置参数值为以下是普通话的句子,这是一段会议记录。,来源:https://blog.csdn.net/gootyking/article/details/134475995 参考 https://zhuanlan.zhihu.com/p/617770448 ...
{type:"string"}initial_prompt=""#@param{type:"string"}condition_on_previous_text=True #@param{type:"boolean"}fp16=True #@param{type:"boolean"}compression_ratio_threshold=2.4#@param{type:"number"}logprob_threshold=-1.0#@param{type:"number"}no_speech_threshold=0.6#@param{type:"slider",...