数据集:
- homebrewltd/instruction-speech-whispervq-v2
语言:
- 英语
许可证: apache-2.0
任务标签: 音频转文本
标签:
- 语音语言模型
模型详情
我们开发并发布了Ichigo-llama3s系列模型。该系列模型原生支持音频和文本输入。
本模型专注于微调homebrewltd/Ichigo-llama3.1-s-instruct-v0.3-phase-2,特别提升了处理模糊输入和多轮对话的能力。
开发团队 Homebrew Research。
输入 文本和音频。
输出 文本。
模型架构 Llama-3。
支持语言: 英语。
使用场景
主要用途 该系列模型主要用于研究场景。本版本旨在进一步提升大语言模型的语音理解能力。
限制范围 禁止以任何违反法律法规的方式使用llama3-s模型。
快速开始
可通过Google Colab笔记本试用本模型。
首先需要将音频文件转换为声音标记:
device = "cuda" if torch.cuda.is_available() else "cpu"
if not os.path.exists("whisper-vq-stoks-medium-en+pl-fixed.model"):
hf_hub_download(
repo_id="jan-hq/WhisperVQ",
filename="whisper-vq-stoks-medium-en+pl-fixed.model",
local_dir=".",
)
vq_model = RQBottleneckTransformer.load_model(
"whisper-vq-stoks-medium-en+pl-fixed.model"
).to(device)
vq_model.ensure_whisper(device)
def audio_to_sound_tokens(audio_path, target_bandwidth=1.5, device=device):
wav, sr = torchaudio.load(audio_path)
if sr != 16000:
wav = torchaudio.functional.resample(wav, sr, 16000)
with torch.no_grad():
codes = vq_model.encode_audio(wav.to(device))
codes = codes[0].cpu().tolist()
result = ''.join(f'<|sound_{num:04d}|>' for num in codes)
return f'<|sound_start|>{result}<|sound_end|>'
然后可以像其他大语言模型一样进行推理:
def setup_pipeline(model_path, use_4bit=False, use_8bit=False):
tokenizer = AutoTokenizer.from_pretrained(model_path)
model_kwargs = {"device_map": "auto"}
if use_4bit:
model_kwargs["quantization_config"] = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
)
elif use_8bit:
model_kwargs["quantization_config"] = BitsAndBytesConfig(
load_in_8bit=True,
bnb_8bit_compute_dtype=torch.bfloat16,
bnb_8bit_use_double_quant=True,
)
else:
model_kwargs["torch_dtype"] = torch.bfloat16
model = AutoModelForCausalLM.from_pretrained(model_path, **model_kwargs)
return pipeline("text-generation", model=model, tokenizer=tokenizer)
def generate_text(pipe, messages, max_new_tokens=64, temperature=0.0, do_sample=False):
generation_args = {
"max_new_tokens": max_new_tokens,
"return_full_text": False,
"temperature": temperature,
"do_sample": do_sample,
}
output = pipe(messages, **generation_args)
return output[0]['generated_text']
llm_path = "homebrewltd/llama3.1-s-instruct-v0.2"
pipe = setup_pipeline(llm_path, use_8bit=True)
训练过程
训练指标图示:下方展示了训练损失曲线的可视化快照。

**MMLU**评估:
模型 |
MMLU得分 |
llama3.5-instruct-8b |
69.40 |
ichigo-llama3.1-s-v0.3: phase 3 |
63.79 |
ichigo-llama3.1-s-v0.3: phase 2 |
63.08 |
ichigo-llama3.1-s-base-v0.3 |
42.11 |
llama3.5-instruct-v0.2 |
50.27 |
AudioBench评估:
硬件配置
GPU配置:8台NVIDIA H100-SXM-80GB组成的集群。
GPU使用情况:
训练参数
我们使用torchtune库实现最新的FSDP2训练代码。
参数 |
持续训练 |
训练轮次 |
1 |
全局批次大小 |
256 |
学习率 |
1.5e-5 |
学习调度器 |
带预热的LambdaLR |
优化器 |
AdamW Fused |
预热步数 |
8 |
权重衰减 |
0.005 |
最大长度 |
4096 |
精度 |
bf16 |
更多细节
论文: http://arxiv.org/abs/2410.15316
引用信息
BibTeX格式:
@article{Llama3-S: 语音指令语言模型 2024,
title={Llama3-S},
author={Homebrew Research},
year=2024,
month=8月},
url={https://huggingface.co/homebrewltd/llama3.1-s-2024-08-20}
致谢