poeroz commited on
Commit
3c46f09
·
verified ·
1 Parent(s): d1a6927

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +155 -0
README.md ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🦙🎧 LLaMA-Omni 2: LLM-based Real-time Spoken Chatbot with Autoregressive Streaming Speech Synthesis
2
+
3
+ > **Authors: [Qingkai Fang](https://fangqingkai.github.io/), [Yan Zhou](https://zhouyan19.github.io/zhouyan/), [Shoutao Guo](https://scholar.google.com/citations?hl=en&user=XwHtPyAAAAAJ), [Shaolei Zhang](https://zhangshaolei1998.github.io/), [Yang Feng*](https://people.ucas.edu.cn/~yangfeng?language=en)**
4
+
5
+ [![arXiv](https://img.shields.io/badge/arXiv-2505.02625-b31b1b.svg?logo=arXiv)](https://arxiv.org/abs/2505.02625)
6
+ [![code](https://img.shields.io/badge/Github-Code-keygen.svg?logo=github)](https://github.com/ictnlp/LLaMA-Omni2)
7
+ [![models](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging_Face-Models-blue.svg)](https://huggingface.co/collections/ICTNLP/llama-omni-67fdfb852c60470175e36e9c)
8
+ [![dataset](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging_Face-Dataset-blue.svg)](https://huggingface.co/datasets/ICTNLP/Multiturn-Speech-Conversations)
9
+
10
+ LLaMA-Omni 2 is a series of speech-language models built on the Qwen2.5-0.5B/1.5B/3B/7B/14B/32B-Instruct models. Similar to [LLaMA-Omni](https://github.com/ictnlp/LLaMA-Omni), it can generate both text and speech responses simultaneously, enabling high-quality and low-latency speech interaction. With the newly introduced streaming autoregressive speech decoder, LLaMA-Omni 2 achieves higher speech quality compared to LLaMA-Omni.
11
+
12
+ <div align="center"><img src="images/llama-omni2.png" width="75%"/></div>
13
+
14
+ ## 🔥 News
15
+
16
+ - [25/05] LLaMA-Omni 2 is accepted at ACL 2025 main conference!
17
+
18
+ ## Install
19
+
20
+ 1. Clone this repository.
21
+
22
+ ```shell
23
+ git clone https://github.com/ictnlp/LLaMA-Omni2
24
+ cd LLaMA-Omni2
25
+ ```
26
+
27
+ 2. Install packages.
28
+
29
+ ```shell
30
+ conda create -n llama-omni2 python=3.10
31
+ conda activate llama-omni2
32
+ pip install -e .
33
+ ```
34
+
35
+ ## Quick Start
36
+
37
+ 1. Download the `Whisper-large-v3` model.
38
+
39
+ ```shell
40
+ import whisper
41
+ model = whisper.load_model("large-v3", download_root="models/speech_encoder/")
42
+ ```
43
+
44
+ 2. Download the flow-matching model and vocoder of `CosyVoice 2`.
45
+
46
+ ```shell
47
+ huggingface-cli download --resume-download ICTNLP/cosy2_decoder --local-dir models/cosy2_decoder
48
+ ```
49
+
50
+ > [!Tip]
51
+ > If you’re experiencing unstable connections to Hugging Face from within China, you can try setting the following in your command line:
52
+ >
53
+ > ```shell
54
+ > export HF_ENDPOINT=https://hf-mirror.com
55
+ > ```
56
+
57
+ 3. Download the LLaMA-Omni2 series models from Hugging Face. `LLaMA-Omni2-0.5B/1.5B/3B/7B/14B` support **English only**, while `LLaMA-Omni2-0.5B/1.5B/3B/7B/14B/32B-Bilingual` support **both English and Chinese**.
58
+
59
+ ```shell
60
+ model_name=LLaMA-Omni2-7B-Bilingual
61
+ huggingface-cli download --resume-download ICTNLP/$model_name --local-dir models/$model_name
62
+ ```
63
+
64
+ | LLaMA-Omni2 | LLaMA-Omni2-Bilingual |
65
+ | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
66
+ | 🤗 [LLaMA-Omni2-0.5B](https://huggingface.co/ICTNLP/LLaMA-Omni2-0.5B) | 🤗 [LLaMA-Omni2-0.5B-Bilingual](https://huggingface.co/ICTNLP/LLaMA-Omni2-0.5B-Bilingual) |
67
+ | 🤗 [LLaMA-Omni2-1.5B](https://huggingface.co/ICTNLP/LLaMA-Omni2-1.5B) | 🤗 [LLaMA-Omni2-1.5B-Bilingual](https://huggingface.co/ICTNLP/LLaMA-Omni2-1.5B-Bilingual) |
68
+ | 🤗 [LLaMA-Omni2-3B](https://huggingface.co/ICTNLP/LLaMA-Omni2-3B) | 🤗 [LLaMA-Omni2-3B-Bilingual](https://huggingface.co/ICTNLP/LLaMA-Omni2-3B-Bilingual) |
69
+ | 🤗 [LLaMA-Omni2-7B](https://huggingface.co/ICTNLP/LLaMA-Omni2-7B) | 🤗 [LLaMA-Omni2-7B-Bilingual](https://huggingface.co/ICTNLP/LLaMA-Omni2-7B-Bilingual) |
70
+ | 🤗 [LLaMA-Omni2-14B](https://huggingface.co/ICTNLP/LLaMA-Omni2-14B) | 🤗 [LLaMA-Omni2-14B-Bilingual](https://huggingface.co/ICTNLP/LLaMA-Omni2-14B-Bilingual) |
71
+ | - | 🤗 [LLaMA-Omni2-32B-Bilingual](https://huggingface.co/ICTNLP/LLaMA-Omni2-32B-Bilingual) |
72
+
73
+ ## Gradio Demo
74
+
75
+ 1. Launch a controller.
76
+
77
+ ```shell
78
+ python -m llama_omni2.serve.controller --host 0.0.0.0 --port 10000
79
+ ```
80
+
81
+ 2. Launch a gradio web server.
82
+
83
+ ```shell
84
+ python -m llama_omni2.serve.gradio_web_server --controller http://localhost:10000 --port 8000 --vocoder-dir models/cosy2_decoder
85
+ ```
86
+
87
+ 3. Launch a model worker.
88
+
89
+ ```shell
90
+ python -m llama_omni2.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path models/$model_name --model-name $model_name
91
+ ```
92
+
93
+ 4. Visit [http://localhost:8000/](http://localhost:8000/) and interact with LLaMA-Omni2!
94
+
95
+ ## Local Inference
96
+
97
+ ```shell
98
+ output_dir=examples/$model_name
99
+ mkdir -p $output_dir
100
+
101
+ python llama_omni2/inference/run_llama_omni2.py \
102
+ --model_path models/$model_name \
103
+ --question_file examples/questions.json \
104
+ --answer_file $output_dir/answers.jsonl \
105
+ --temperature 0 \
106
+ --s2s
107
+
108
+ python llama_omni2/inference/run_cosy2_decoder.py \
109
+ --input-path $output_dir/answers.jsonl \
110
+ --output-dir $output_dir/wav \
111
+ --lang en
112
+ ```
113
+
114
+ ## LICENSE
115
+
116
+ Our code is released under the Apache-2.0 License. Our model is intended for academic research purposes only and may **NOT** be used for commercial purposes.
117
+
118
+ You are free to use, modify, and distribute this model in academic settings, provided that the following conditions are met:
119
+
120
+ - **Non-commercial use**: The model may not be used for any commercial purposes.
121
+ - **Citation**: If you use this model in your research, please cite the original work.
122
+
123
+ ### Commercial Use Restriction
124
+
125
+ For any commercial use inquiries or to obtain a commercial license, please contact `[email protected]`.
126
+
127
+ ## Acknowledgements
128
+
129
+ - [CosyVoice 2](https://github.com/FunAudioLLM/CosyVoice): We use the pretrained speech tokenizer, flow-matching model and vocoder of CosyVoice 2.
130
+ - [SLAM-LLM](https://github.com/X-LANCE/SLAM-LLM): We borrow some code about speech encoder and speech adaptor.
131
+
132
+ ## Citation
133
+
134
+ If you have any questions, please feel free to submit an issue or contact `[email protected]`.
135
+
136
+ If our work is useful for you, please cite as:
137
+
138
+ ```
139
+ @inproceedings{
140
+ fang2025llamaomni2,
141
+ title={{LL}a{MA}-{O}mni 2: LLM-based Real-time Spoken Chatbot with Autoregressive Streaming Speech Synthesis},
142
+ author={Fang, Qingkai and Zhou, Yan and Guo, Shoutao and Zhang, Shaolei and Feng, Yang},
143
+ booktitle = {Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics},
144
+ year={2025}
145
+ }
146
+
147
+ @inproceedings{
148
+ fang2025llamaomni,
149
+ title={{LL}a{MA}-{O}mni: Seamless Speech Interaction with Large Language Models},
150
+ author={Qingkai Fang and Shoutao Guo and Yan Zhou and Zhengrui Ma and Shaolei Zhang and Yang Feng},
151
+ booktitle={The Thirteenth International Conference on Learning Representations},
152
+ year={2025},
153
+ url={https://openreview.net/forum?id=PYmrUQmMEw}
154
+ }
155
+ ```