🚀 🐟 Llama-3-EvoVLM-JP-v2
Llama-3-EvoVLM-JP-v2 是一款实验性的通用日语视觉语言模型(VLM),支持以交错的文本和图像作为输入。该模型采用进化模型融合方法创建。更多详细信息,请参考我们的报告和博客。此模型通过融合以下模型产生,我们感谢这些源模型的开发者。
🤗 模型 | 📚 论文 | 📝 博客 | 🐦 推特
🚀 快速开始
使用以下代码开始使用该模型。
点击展开
首先,你需要使用 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 对因使用此模型而产生的任何直接、间接、特殊、偶然或后果性损害,或任何损失不承担责任,无论获得何种结果。用户必须充分了解使用此模型的相关风险,并自行决定是否使用。
📄 许可证
本模型使用 META LLAMA 3 社区许可证。
🙏 致谢
我们感谢源模型的开发者所做出的贡献,并感谢他们公开其工作成果。
📖 引用
@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}
}