🚀 Ichigo-llama3s模型
Ichigo-llama3s模型家族由Homebrew Research开发并发布,该模型家族能够原生理解音频和文本输入。此模型专注于微调,以改善用户交互,尤其在处理听不见的输入和多轮对话方面表现出色。
🚀 快速开始
你可以通过 Google Colab Notebook 来试用这个模型。
步骤1:将音频文件转换为声音令牌
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|>'
步骤2:像其他大语言模型一样进行推理
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)
✨ 主要特性
- 多模态输入:原生支持音频和文本输入。
- 优化交互:针对处理听不见的输入和多轮对话进行了微调。
📚 详细文档
模型详情
我们开发并发布了 Ichigo-llama3s 模型家族。该家族能够原生理解音频和文本输入。
此模型专注于对 homebrewltd/Ichigo-llama3.1-s-instruct-v0.3-phase-2 模型进行微调,以改善用户交互,尤其是在处理听不见的输入和多轮对话方面。
属性 |
详情 |
模型开发者 |
Homebrew Research |
输入 |
文本和声音 |
输出 |
文本 |
模型架构 |
Llama-3 |
语言 |
英语 |
预期用途
- 预期用例:该模型家族主要用于研究应用。此版本旨在进一步提升大语言模型的声音理解能力。
- 超出范围:严禁以任何违反适用法律法规的方式使用 llama3-s。
🔧 技术细节
训练过程
训练指标图像
以下是训练损失曲线的可视化快照。

模型 |
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 |
硬件
- 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}
🙏 致谢