🚀 🐟 Llama-3-EvoVLM-JP-v2
Llama-3-EvoVLM-JP-v2 は、テキストと画像を交互に入力できる、実験的な汎用日本語VLM(視覚言語モデル)です。このモデルは、進化的モデルマージ手法を用いて作成されました。詳細については、レポート と ブログ を参照してください。このモデルは以下のモデルをマージして作成されています。ソースモデルの開発者の皆様に感謝いたします。
🤗 Models | 📚 Paper | 📝 Blog | 🐦 Twitter
🚀 クイックスタート
以下のコードを使って、モデルの使用を始めましょう。
クリックして展開
まず、Mantisを使用して推論するためのパッケージをインストールする必要があります。詳細は こちら を参照してください。
pip install git+https://github.com/TIGER-AI-Lab/Mantis.git
import requests
from PIL import Image
import torch
from mantis.models.conversation import Conversation, SeparatorStyle
from mantis.models.mllava import chat_mllava, LlavaForConditionalGeneration, MLlavaProcessor
from mantis.models.mllava.utils import conv_templates
from transformers import AutoTokenizer
conv_llama_3_elyza = Conversation(
system="<|start_header_id|>system<|end_header_id|>\n\nあなたは誠実で優秀な日本人のアシスタントです。特に指示が無い場合は、常に日本語で回答してください。",
roles=("user", "assistant"),
messages=(),
offset=0,
sep_style=SeparatorStyle.LLAMA_3,
sep="<|eot_id|>",
)
conv_templates["llama_3"] = conv_llama_3_elyza
device = "cuda" if torch.cuda.is_available() else "cpu"
model_id = "SakanaAI/Llama-3-EvoVLM-JP-v2"
processor = MLlavaProcessor.from_pretrained("TIGER-Lab/Mantis-8B-siglip-llama3")
processor.tokenizer.pad_token = processor.tokenizer.eos_token
model = LlavaForConditionalGeneration.from_pretrained(model_id, torch_dtype=torch.float16, device_map=device).eval()
generation_kwargs = {
"max_new_tokens": 128,
"num_beams": 1,
"do_sample": False,
"no_repeat_ngram_size": 3,
}
text = "<image>の信号は何色ですか?"
url_list = [
"https://images.unsplash.com/photo-1694831404826-3400c48c188d?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
"https://images.unsplash.com/photo-1693240876439-473af88b4ed7?q=80&w=1974&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
]
images = [
Image.open(requests.get(url_list[0], stream=True).raw).convert("RGB")
]
response, history = chat_mllava(text, images, model, processor, **generation_kwargs)
print(response)
text = "では、<image>の信号は?"
images += [
Image.open(requests.get(url_list[1], stream=True).raw).convert("RGB")
]
response, history = chat_mllava(text, images, model, processor, history=history, **generation_kwargs)
print(response)
📚 ドキュメント
💡 使用に関する注意
このモデルは研究開発目的のみで提供されており、実験的なプロトタイプとして扱われるべきです。商用利用や重要な環境でのデプロイを目的としたものではありません。このモデルの使用はユーザーの自己責任で行ってください。モデルの性能や結果は保証されていません。Sakana AIは、このモデルの使用によって生じる直接的、間接的、特別な、偶発的、または結果的な損害や損失について一切の責任を負いません。ユーザーは、このモデルの使用に関連するリスクを十分に理解し、自己判断で使用する必要があります。
🙏 謝辞
ソースモデルの開発者の皆様に、貢献と成果を公開していただいたことに感謝いたします。
📖 引用
@misc{Llama-3-EvoVLM-JP-v2,
url = {[https://huggingface.co/SakanaAI/Llama-3-EvoVLM-JP-v2](https://huggingface.co/SakanaAI/Llama-3-EvoVLM-JP-v2)},
title = {Llama-3-EvoVLM-JP-v2},
author = {Yuichi, Inoue and Takuya, Akiba and Shing, Makoto}
}
@misc{akiba2024evomodelmerge,
title = {Evolutionary Optimization of Model Merging Recipes},
author. = {Takuya Akiba and Makoto Shing and Yujin Tang and Qi Sun and David Ha},
year = {2024},
eprint = {2403.13187},
archivePrefix = {arXiv},
primaryClass = {cs.NE}
}