WhisperBot:整合了Mistral大型语言模型的实时语音转文本系统

WhisperBot:整合了Mistral大型语言模型的实时语音转文本系统

    正在检查是否收录...

项目简介

欢迎来到 WhisperBot。WhisperBot 基于 WhisperLive 和 WhisperSpeech 的功能而构建,在实时语音到文本管道之上集成了大型语言模型 Mistral (LLM)。WhisperLive 依赖于 OpenAI Whisper,这是一个强大的自动语音识别 (ASR) 系统。Mistral 和 Whisper 都经过优化,可作为 TensorRT 引擎高效运行,从而最大限度地提高性能和实时处理能力。

特征

实时语音转文本:利用 OpenAI WhisperLive 将口语实时转换为文本。

大型语言模型集成:添加大型语言模型 Mistral,以增强对转录文本的理解和上下文。

TensorRT 优化:Mistral 和 Whisper 都经过优化,可作为 TensorRT 引擎运行,确保高性能和低延迟处理。

先决条件

安装 TensorRT-LLM 来构建 Whisper 和 Mistral TensorRT 引擎。自述文件为 TensorRT-LLM 构建了一个 docker 镜像。除了构建 docker 镜像之外,我们还可以参考 README 和 Dockerfile.multi 在基础 pytroch docker 镜像中安装所需的包。只要确保使用 dockerfile 中提到的正确的基础镜像,一切都会顺利进行。

构建 Whisper TensorRT 引擎

将工作目录更改为 TensorRT-LLM 中的耳语示例目录。

cd TensorRT-LLM/examples/whisper

目前,默认情况下 TensorRT-LLM 仅支持 large-v2 和 large-v3 。在此存储库中,我们使用 small.en 。

下载所需的资源。

wget --directory-prefix=assets assets/mel_filters.npz https://raw.githubusercontent.com/openai/whisper/main/whisper/assets/mel_filters.npz # small.en modelwget --directory-prefix=assets https://openaipublic.azureedge.net/main/whisper/models/f953ad0fd29cacd07d5a9eda5624af0f6bcf2258be67c92b79389873d91e0872/small.en.pt

编辑 build.py 以支持 small.en 。为此,请将 "small.en" 添加为列表 choices 中的项目。

构建 small.en TensorRT 引擎。

pip install -r requirements.txtpython3 build.py --output_dir whisper_small_en --use_gpt_attention_plugin --use_gemm_plugin --use_layernorm_plugin --use_bert_attention_plugin --model_name small.en

构建 Mistral TensorRT 引擎

将工作目录更改为 TensorRT-LLM 文件夹中的 llama 示例目录。

cd TensorRT-LLM/examples/llama

将 Mistral 转换为 fp16 TensorRT 引擎。

 python build.py --model_dir teknium/OpenHermes-2.5-Mistral-7B \ --dtype float16 \ --remove_input_padding \ --use_gpt_attention_plugin float16 \ --enable_context_fmha \ --use_gemm_plugin float16 \ --output_dir ./tmp/mistral/7B/trt_engines/fp16/1-gpu/ \ --max_input_len 5000 --max_batch_size 1

构建 Phi TensorRT 引擎

注意:Phi 仅在主分支可用,尚未发布。因此,请确保从主分支构建 TensorRT-LLM。

将工作目录更改为 TensorRT-LLM 文件夹中的 phi 示例目录。

cd TensorRT-LLM/examples/phi

构建 phi TensorRT 引擎

git lfs install git clone https://huggingface.co/microsoft/phi-2 python3 build.py --dtype=float16 \ --log_level=verbose \ --use_gpt_attention_plugin float16 \ --use_gemm_plugin float16 \ --max_batch_size=16 \ --max_input_len=1024 \ --max_output_len=1024 \ --output_dir=phi_engine \ --model_dir=phi-2>&1 | tee build.log

项目链接

https://github.com/collabora/WhisperBot

tensorrtcodewhisperllmdockerdocopenaitpugitgptbot语言模型python大型语言模型fix文件夹高性能llamactogithubrfiurlclone语音识别语音转文本上下文bert实时语音转文本gpumicrosofthuggingface自动语音识别实时转换实时处理azureasr
  • 本文作者:李琛
  • 本文链接: https://wapzz.net/post-7830.html
  • 版权声明:本博客所有文章除特别声明外,均默认采用 CC BY-NC-SA 4.0 许可协议。
本站部分内容来源于网络转载,仅供学习交流使用。如涉及版权问题,请及时联系我们,我们将第一时间处理。
文章很赞!支持一下吧 还没有人为TA充电
为TA充电
还没有人为TA充电
0
  • 支付宝打赏
    支付宝扫一扫
  • 微信打赏
    微信扫一扫
感谢支持
文章很赞!支持一下吧
关于作者
2.3W+
5
0
1
WAP站长官方

第四范式AIGC的野心,改变软件行业游戏规则

上一篇

AIGC与计算机技术:人工智能生成内容的深度探索

下一篇
  • 复制图片
按住ctrl可打开默认菜单