作者:Qingkai Fang, Shoutao Guo, Yan Zhou, Zhengrui Ma, Shaolei Zhang, Yang Feng*
LLaMA-Omni 是一个基于 Llama-3.1-8B-Instruct 构建的语音语言模型。它支持低延迟、高质量的语音交互,能够根据语音指令同时生成文本和语音响应。

💪 基于 Llama-3.1-8B-Instruct,确保高质量响应。
🚀 低延迟语音交互,延迟可低至 226ms。
🎧 同时生成文本和语音响应。
♻️ 仅需 4 张 GPU,训练时间不超过 3 天。
https://github.com/user-attachments/assets/2b097af8-47d7-494f-b3b3-6be17ca0247a
git clone https://github.com/ictnlp/LLaMA-Omni
cd LLaMA-Omni
conda create -n llama-omni python=3.10
conda activate llama-omni
pip install pip==24.0
pip install -e .
fairseq。git clone https://github.com/pytorch/fairseq
cd fairseq
pip install -e . --no-build-isolation
flash-attention。pip install flash-attn --no-build-isolation
从 🤗Huggingface 下载 Llama-3.1-8B-Omni 模型。
下载 Whisper-large-v3 模型。
import whisper
model = whisper.load_model("large-v3", download_root="models/speech_encoder/")
wget https://dl.fbaipublicfiles.com/fairseq/speech_to_speech/vocoder/code_hifigan/mhubert_vp_en_es_fr_it3_400k_layer11_km1000_lj/g_00500000 -P vocoder/
wget https://dl.fbaipublicfiles.com/fairseq/speech_to_speech/vocoder/code_hifigan/mhubert_vp_en_es_fr_it3_400k_layer11_km1000_lj/config.json -P vocoder/
python -m omni_speech.serve.controller --host 0.0.0.0 --port 10000
python -m omni_speech.serve.gradio_web_server --controller http://localhost:10000 --port 8000 --model-list-mode reload --vocoder vocoder/g_00500000 --vocoder-cfg vocoder/config.json
python -m omni_speech.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path Llama-3.1-8B-Omni --model-name Llama-3.1-8B-Omni --s2s
注意:由于 Gradio 中流式音频播放不稳定,我们仅实现了流式音频合成,但未开启自动播放。如果你有好的解决方案,欢迎提交 PR。谢谢!
如需在本地进行推理,请按照 omni_speech/infer/examples 目录中的格式组织语音指令文件,然后参考以下脚本。
bash omni_speech/infer/run.sh omni_speech/infer/examples
我们的代码基于 Apache-2.0 许可证发布。我们的模型仅供学术研究使用,不得用于商业目的。
你可以在学术环境中自由使用、修改和分发此模型,但需满足以下条件:
如有任何商业使用需求或获取商业许可证,请联系 fengyang@ict.ac.cn。
如有任何问题,请随时提交 issue 或联系 fangqingkai21b@ict.ac.cn。
如果我们的工作对你有帮助,请引用:
@article{fang-etal-2024-llama-omni,
title={LLaMA-Omni: Seamless Speech Interaction with Large Language Models},
author={Fang, Qingkai and Guo, Shoutao and Zhou, Yan and Ma, Zhengrui and Zhang, Shaolei and Feng, Yang},
journal={arXiv preprint arXiv:2409.06666},
year={2024}
}