🚀 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|>'
次に、他のLLMと同じようにモデルを推論することができます。
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
- 言語: 英語
想定使用法
- 想定使用例: 主に研究用途を想定しています。このバージョンは、音声理解能力に関するLLMのさらなる改善を目指しています。
- 想定外の使用: 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使用時間:
学習引数
torchtune ライブラリを使用して、最新のFSDP2学習コードを実装しています。
パラメータ |
継続学習 |
エポック |
1 |
グローバルバッチサイズ |
256 |
学習率 |
1.5e-5 |
学習スケジューラ |
ウォームアップ付きLambdaLR |
オプティマイザ |
AdamW Fused |
ウォームアップステップ |
8 |
重み減衰 |
0.005 |
最大長 |
4096 |
精度 |
bf16 |
その他詳細
- 論文: http://arxiv.org/abs/2410.15316
引用情報
@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}
謝辞
📄 ライセンス
このモデルは、Apache-2.0ライセンスの下で提供されています。