Update README.md
Browse files
README.md
CHANGED
@@ -8,4 +8,123 @@ tags:
|
|
8 |
- speech-language models
|
9 |
- speech interaction
|
10 |
- speech-to-speech
|
11 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
- speech-language models
|
9 |
- speech interaction
|
10 |
- speech-to-speech
|
11 |
+
---
|
12 |
+
|
13 |
+
# π§ LLaMA-Omni: Seamless Speech Interaction with Large Language Models
|
14 |
+
|
15 |
+
> **Authors: [Qingkai Fang](https://fangqingkai.github.io/), [Shoutao Guo](https://scholar.google.com/citations?hl=en&user=XwHtPyAAAAAJ), [Yan Zhou](https://zhouyan19.github.io/zhouyan/), [Zhengrui Ma](https://scholar.google.com.hk/citations?user=dUgq6tEAAAAJ), [Shaolei Zhang](https://zhangshaolei1998.github.io/), [Yang Feng*](https://people.ucas.edu.cn/~yangfeng?language=en)**
|
16 |
+
|
17 |
+
[![arXiv](https://img.shields.io/badge/arXiv-xxxx.xxxxx-b31b1b.svg?logo=arXiv)](https://arxiv.org/abs/xxxx.xxxxx)
|
18 |
+
[![model](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging_Face-Model-blue.svg)](https://huggingface.co/ICTNLP/Llama-3.1-8B-Omni)
|
19 |
+
[![code](https://img.shields.io/badge/Github-Code-keygen.svg?logo=github)](https://github.com/ictnlp/LLaMA-Omni)
|
20 |
+
|
21 |
+
|
22 |
+
LLaMA-Omni is a speech-language model built upon Llama-3.1-8B-Instruct. It supports low-latency and high-quality speech interactions, simultaneously generating both text and speech responses based on speech instructions.
|
23 |
+
|
24 |
+
![](images/model.png)
|
25 |
+
|
26 |
+
## π‘ Highlights
|
27 |
+
|
28 |
+
πͺ **Built on Llama-3.1-8B-Instruct, ensuring high-quality responses.**
|
29 |
+
|
30 |
+
π **Low-latency speech interaction with a latency as low as 226ms.**
|
31 |
+
|
32 |
+
π§ **Simultaneous generation of both text and speech responses.**
|
33 |
+
|
34 |
+
β»οΈ **Trained in less than 3 days using just 4 GPUs.**
|
35 |
+
|
36 |
+
## Install
|
37 |
+
|
38 |
+
1. Clone this repository.
|
39 |
+
|
40 |
+
```shell
|
41 |
+
git clone https://github.com/ictnlp/LLaMA-Omni
|
42 |
+
cd LLaMA-Omni
|
43 |
+
```
|
44 |
+
|
45 |
+
2. Install packages.
|
46 |
+
|
47 |
+
```shell
|
48 |
+
conda create -n llama-omni python=3.10
|
49 |
+
conda activate llama-omni
|
50 |
+
pip install pip==24.0
|
51 |
+
pip install -e .
|
52 |
+
```
|
53 |
+
|
54 |
+
3. Install `fairseq`.
|
55 |
+
|
56 |
+
```shell
|
57 |
+
git clone https://github.com/pytorch/fairseq
|
58 |
+
cd fairseq
|
59 |
+
pip install -e . --no-build-isolation
|
60 |
+
```
|
61 |
+
|
62 |
+
4. Install `flash-attention`.
|
63 |
+
|
64 |
+
```shell
|
65 |
+
pip install flash-attn --no-build-isolation
|
66 |
+
```
|
67 |
+
|
68 |
+
## Quick Start
|
69 |
+
|
70 |
+
1. Download the `Llama-3.1-8B-Omni` model from π€[Huggingface](https://huggingface.co/ICTNLP/Llama-3.1-8B-Omni).
|
71 |
+
|
72 |
+
2. Download the `Whisper-large-v3` model.
|
73 |
+
|
74 |
+
```shell
|
75 |
+
import whisper
|
76 |
+
model = whisper.load_model("large-v3", download_root="models/speech_encoder/")
|
77 |
+
```
|
78 |
+
|
79 |
+
3. Download the unit-based HiFi-GAN vocoder.
|
80 |
+
|
81 |
+
```shell
|
82 |
+
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/
|
83 |
+
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/
|
84 |
+
```
|
85 |
+
|
86 |
+
## Gradio Demo
|
87 |
+
|
88 |
+
1. Launch a controller.
|
89 |
+
```shell
|
90 |
+
python -m omni_speech.serve.controller --host 0.0.0.0 --port 10000
|
91 |
+
```
|
92 |
+
|
93 |
+
2. Launch a gradio web server.
|
94 |
+
```shell
|
95 |
+
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
|
96 |
+
```
|
97 |
+
|
98 |
+
3. Launch a model worker.
|
99 |
+
```shell
|
100 |
+
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
|
101 |
+
```
|
102 |
+
|
103 |
+
4. Visit [http://localhost:8000/](http://localhost:8000/) and interact with LLaMA-3.1-8B-Omni!
|
104 |
+
|
105 |
+
## Local Inference
|
106 |
+
|
107 |
+
To run inference locally, please organize the speech instruction files according to the format in the `omni_speech/infer/examples` directory, then refer to the following script.
|
108 |
+
```shell
|
109 |
+
bash omni_speech/infer/run.sh omni_speech/infer/examples
|
110 |
+
```
|
111 |
+
|
112 |
+
## Acknowledgements
|
113 |
+
|
114 |
+
- [LLaVA](https://github.com/haotian-liu/LLaVA): The codebase we built upon.
|
115 |
+
- [SLAM-LLM](https://github.com/X-LANCE/SLAM-LLM): We borrow some code about speech encoder and speech adaptor.
|
116 |
+
|
117 |
+
## Citation
|
118 |
+
|
119 |
+
If you have any questions, please feel free to submit an issue or contact `fangqingkai21b@ict.ac.cn`.
|
120 |
+
|
121 |
+
If our work is useful for you, please cite as:
|
122 |
+
|
123 |
+
```
|
124 |
+
@article{fang-etal-2024-llama-omni,
|
125 |
+
title={LLaMA-Omni: Seamless Speech Interaction with Large Language Models},
|
126 |
+
author={Fang, Qingkai and Guo, Shoutao and Zhou, Yan and Ma, Zhengrui and Zhang, Shaolei and Feng, Yang},
|
127 |
+
journal={arXiv preprint arXiv:xxxx.xxxxx},
|
128 |
+
year={2024}
|
129 |
+
}
|
130 |
+
```
|