模型简介
模型特点
模型能力
使用案例
🚀 Ichigo-llama3s 模型
Ichigo-llama3s 是一个原生支持音频和文本输入的模型家族,可用于研究应用,在音频理解能力上有出色表现。
🚀 快速开始
你可以通过 Google Colab Notebook 来试用该模型。
首先,需要将音频文件转换为声音标记:
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']
# Usage
llm_path = "homebrewltd/llama3.1-s-instruct-v0.2"
pipe = setup_pipeline(llm_path, use_8bit=True)
✨ 主要特性
- 原生支持音频和文本输入。
- 专注于微调模型,以改善用户交互,特别是在处理听不见的输入和多轮对话方面。
📚 详细文档
模型详情
- 数据集:
- 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。
训练过程
-
训练指标图像:以下是训练损失曲线的可视化快照。
-
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 评估: | 模型基准 | Open - hermes Instruction Audio (GPT - 4 - O judge 0:5) | Alpaca Instruction Audio (GPT - 4 - O judge 0:5) | | --- | --- | --- | | [Llama3.1 - s - v2](https://huggingface.co/homebrewltd/llama3 - s - instruct - v0.2) | 3.45 | 3.53 | | [Ichigo - llama3.1 - s v0.3 - phase2 - cp7000](https://huggingface.co/homebrewltd/Ichigo - llama3.1 - s - instruct - v0.3 - phase - 2) | 3.42 | 3.62 | | [Ichigo - llama3.1 - s v0.3 - phase2 - cplast](https://huggingface.co/jan - hq/llama3 - s - instruct - v0.3 - checkpoint - last) | 3.31 | 3.6 | | [Ichigo - llama3.1 - s v0.3 - phase3](https://huggingface.co/homebrewltd/Ichigo - llama3.1 - s - instruct - v0.3 - phase - 3) | 3.64 | 3.68 | | [Qwen2 - audio - 7B](https://huggingface.co/Qwen/Qwen2 - Audio - 7B) | 2.63 | 2.24 |
硬件
- GPU 配置:8 个 NVIDIA H100 - SXM - 80GB 组成的集群。
- GPU 使用情况:
- 持续训练:3 小时。
训练参数
我们使用 torchtune 库来实现最新的 FSDP2 训练代码。
参数 | 持续训练 |
---|---|
轮数 | 1 |
全局批量大小 | 256 |
学习率 | 1.5e - 5 |
学习率调度器 | 带热身的 LambdaLR |
优化器 | AdamW Fused |
热身步数 | 8 |
权重衰减 | 0.005 |
最大长度 | 4096 |
精度 | bf16 |
更多细节
论文链接:http://arxiv.org/abs/2410.15316
📄 许可证
本项目采用 apache - 2.0 许可证。
📖 引用信息
BibTeX:
@article{Llama3-S: Sound Instruction Language Model 2024,
title={Llama3-S},
author={Homebrew Research},
year=2024,
month=August,
url={https://huggingface.co/homebrewltd/llama3.1-s-2024-08-20}
🙏 致谢
- WhisperSpeech
- [Meta - Llama - 3.1 - 8B - Instruct ](https://huggingface.co/meta - llama/Meta - Llama - 3.1 - 8B - Instruct)











