库名称: transformers
许可证: llama3.1
语言:
台风2-音频版
台风2-音频版是一个端到端的语音转语音模型架构,能够处理音频、语音和文本输入,并同时生成文本和语音输出。该模型专门针对泰语优化,同时也支持英语。
- GitHub: https://github.com/scb-10x/typhoon2-audio/
- 演示: https://audio.opentyphoon.ai/
- 论文: https://arxiv.org/abs/2412.13702
模型描述
- 模型类型: 该大语言模型基于台风2大语言模型。
- 要求: Python==3.10 & transformers==4.52.2 & fairseq==0.12.2 & flash-attn
- 主要语言: 泰语 🇹🇭 和英语 🇬🇧
- 语音输入与LLM许可证: Llama 3.1社区许可证
- 语音输出许可证: CC-BY-NC
安装
pip install pip==24.0
pip install transformers==4.45.2
pip install fairseq==0.12.2
pip install flash-attn
使用
加载模型
import torch
from transformers import AutoModel
model = AutoModel.from_pretrained(
"scb10x/llama3.1-typhoon2-audio-8b-instruct",
torch_dtype=torch.float16,
trust_remote_code=True
)
model.to("cuda")
推理 - 单轮示例
conversation = [
{"role": "system", "content": "你是一个乐于助人的女性助手,名叫台风。"},
{
"role": "user",
"content": [
{
"type": "audio",
"audio_url": "examples/tmp-2860cd0a094b64043226167340af03a3.wav",
},
{"type": "text", "text": "转录这段音频"},
],
},
]
x = model.generate(
conversation=conversation,
max_new_tokens=500,
do_sample=True,
num_beams=1,
top_p=0.9,
repetition_penalty=1.0,
length_penalty=1.0,
temperature=0.7,
)
推理 - 多轮示例
conversation_multi_turn = [
{
"role": "system",
"content": "你是一个乐于助人的女性助手,名叫台风。请用对话的方式回应提供的语音,使用语音所用的语言。",
},
{
"role": "user",
"content": [
{
"type": "audio",
"audio_url": "examples/tmp-2860cd0a094b64043226167340af03a3.wav",
},
{
"type": "text",
"text": "",
},
],
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "好的,我会告诉你一些美国的大城市名字:\n\n1. 纽约\n2. 洛杉矶\n3. 芝加哥\n4. 休斯顿\n5. 费城\n6. 波士顿\n7. 旧金山\n8. 华盛顿特区\n9. 亚特兰大\n10. 西雅图\n\n如果你需要更多信息或有其他问题,请随时提问。",
},
],
},
{
"role": "user",
"content": [
{
"type": "audio",
"audio_url": "examples/tmp-2284cd76e1c875525ff75327a2fc3610.wav",
},
],
},
]
x = model.generate(conversation=conversation_multi_turn)
文本转语音功能
y = model.synthesize_speech("你好,我叫台风,我是一个专门处理泰语的语言模型")
评估结果
模型 |
ASR-英语 (WER↓) |
ASR-泰语 (WER↓) |
英译泰 (BLEU↑) |
多语言译泰 (BLEU↑) |
泰译英 (BLEU↑) |
SALMONN-13B |
5.79 |
98.07 |
0.07 |
0.10 |
14.97 |
DiVA-8B |
30.28 |
65.21 |
9.82 |
5.31 |
7.97 |
Gemini-1.5-pro-001 |
5.98 |
13.56 |
20.69 |
13.52 |
22.54 |
台风-音频版 |
8.72 |
14.17 |
17.52 |
10.67 |
24.14 |
台风2-音频版 |
5.83 |
14.04 |
27.15 |
15.93 |
33.25 |
模型 |
泰语性别识别 (准确率) |
泰语口语问答 (F1) |
语音指令理解(英语,泰语) |
SALMONN-13B |
93.26 |
2.95 |
2.47, 1.18 |
DiVA-8B |
50.12 |
15.13 |
6.81, 2.68 |
Gemini-1.5-pro-001 |
81.32 |
62.10 |
3.24, 3.93 |
台风-音频版 |
93.74 |
64.60 |
5.62, 6.11 |
台风2-音频版 |
75.65 |
70.01 |
6.00, 6.79 |
模型 |
英语语音质量 |
英语语音风格 |
泰语语音质量 |
泰语语音风格 |
Llama-Omni |
5.15 |
5.79 |
1.71 |
2.14 |
GPT-4o-Audio |
6.82 |
7.86 |
6.66 |
8.07 |
台风2-音频版 |
4.92 |
5.39 |
7.19 |
8.04 |
模型 |
英语语音CER |
英语语音UTMOS |
泰语语音CER |
泰语语音UTMOS |
Llama-Omni* |
3.40 |
3.93 |
6.30 |
3.93 |
GPT-4o-Audio |
3.20 |
3.65 |
8.05 |
3.46 |
台风2-音频版 |
26.50 |
2.29 |
8.67 |
2.35 |
*注意:Llama-Omni不生成泰语文本/语音,因此由于输出为英语,CER较低且UTMOS较高。
预期用途与限制
该模型为实验性质,可能无法始终准确遵循人类指令,容易产生幻觉。此外,该模型缺乏审核机制,可能产生有害或不适当的回应。开发者应根据具体应用仔细评估潜在风险。
关注与支持
- https://twitter.com/opentyphoon
- https://discord.gg/us5gAYmrxw
致谢
我们要感谢SALMONN团队和Llama-Omni团队开源他们的代码和数据,感谢玛希隆大学生物医学与数据实验室发布微调的Whisper,使我们能够采用其编码器。感谢许多其他开源项目分享的有用知识、数据、代码和模型权重。
台风团队
Potsawee Manakul, Warit Sirichotedumrong, Kunat Pipatanakul, Pittawat Taveekitworachai, Natapong Nitarach, Surapon Nonesung, Teetouch Jaknamon, Parinthapat Pengpun, Pittawat Taveekitworachai, Adisai Na-Thalang, Sittipong Sripaisarnmongkol, Krisanapong Jirayoot, Kasima Tharnpipitchai
引用
@misc{typhoon2,
title={Typhoon 2: A Family of Open Text and Multimodal Thai Large Language Models},
author={Kunat Pipatanakul and Potsawee Manakul and Natapong Nitarach and Warit Sirichotedumrong and Surapon Nonesung and Teetouch Jaknamon and Parinthapat Pengpun and Pittawat Taveekitworachai and Adisai Na-Thalang and Sittipong Sripaisarnmongkol and Krisanapong Jirayoot and Kasima Tharnpipitchai},
year={2024},
eprint={2412.13702},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2412.13702},
}