whisper使用说明书 | 您所在的位置:网站首页 › shisper怎么读 › whisper使用说明书 |
默认模式运行
简单运行中全部使用默认参数,默认模型为small模型,默认模型加载路径在当前用户的cached目录中,运行之后会默认识别音频中的语言。 whisper input.wav 指定模型若要修改默认的模型,可以添加–model 模型名参数的方式指定使用哪一种模型进行转录。 下面是可以切换的模型: tiny.en,tiny,base.en,base,small.en,small,medium.en,medium,large-v1,large-v2,large下面是官方给出的各个模型的情况: 下面是如何指定模型例子: whisper --model large input.wav 指定转录后保存文件的格式可选的文件格式有: txt,vtt,srt,tsv,json其中默认是输出所有格式。 如果想要明确指定某一种格式,可以使用–output_format 格式的方式,请看下面的例子: whisper --model large --output_format srt input.wav 指定使用CPU还是CUDA来转录通过参数–device来指定,例子:(如果cuda可用,默认优先使用cuda,cuda指的是使用显卡来转录) whisper --model large --output_format srt --device cuda input.wav 翻译成英语任何支持的语言可以直接翻译成英语输出,使用–task translate,默认它的值为transcribe,表示转录,例子: whisper --model large --output_format srt --device cuda --task translate input.wav 指定语言使用–language来指定音频中的语言,例子: whisper --model large --output_format srt --device cuda --task transcribe --language Chinese input.wav 指定输出位置使用–output_dir,默认为当前运行命令的目前,例子: whisper --model large --output_format srt --output_dir ../output --language Chinese input.wav 指定是否在控制台打印输出使用–verbose,值为布尔类型,默认为True,例子: whisper --model large --verbose False --language Chinese input.wav 指定是否返回字时间戳使用–word_timestamps,值为布尔类型,默认为False,如果想要返回字级时间戳,可以把值改为True,例子: whisper --model large --word_timestamps True input.wav 使用initial_prompt让其尽量输出简体中文如果没有使用该参数,那么有可能会转录成繁体中文,例子: whisper --model large --initial_prompt "转换为简体中文" input.wav上面的方式是让其尽量转录成简体中文,不一定是简体中文。 faster-whisper使用文档1.1 模型 模型:默认medium。 "tiny", "base", "small", "medium", "large", "large-v2"例子: python faster-whisper.py --model large --inputs test.wav --output ./1.2 指定输入音频 必须指定输入音频文件,例子: python faster-whisper.py --inputs test.wav --output ./test.srt1.3 指定保存文件路径 必须指定保存转录结果路径(包括文件名),例子: python faster-whisper.py --inputs test.wav --output ./test.srt1.4 指定精度 默认精度为int8,需要主要使用CPU必须指定为int8,否则会报错。可选的精度有int8,float16。 例子: python faster-whisper.py --inputs test.wav --output ./test.srt --compute_type float161.5 指定使用CPU还是CUDA 通过参数–device来指定使用CPU还是CUDA来转录,默认使用CPU。 例子: python faster-whisper.py --inputs test.wav --output ./test.srt --compute_type float16 --device cuda1.6 指定initial_prompt 通过–initial_prompt参数可以指定转录成简体中文还是繁体中文,例子: python faster-whisper.py --inputs test.wav --output ./test.srt --compute_type float16 --device cuda --initial_prompt "转录为简体中文"1.7 指定语言 通过–language来指定音频中的主要语言,默认不设置会自动识别,例子: python faster-whisper.py --inputs test.wav --output ./test.srt --language zhQ.E.D. |
CopyRight 2018-2019 实验室设备网 版权所有 |