🚀 Heron-NVILA-Lite-2B
Heron-NVILA-Lite-2B是一个基于NVILA-Lite架构、为日语训练的视觉语言模型。它能够处理图像和文本输入,输出相应的文本内容,在多模态交互场景中具有重要价值。
✨ 主要特性
- 多语言支持:支持日语和英语两种语言。
- 多模态处理:能够处理图像和文本的输入,实现图像与文本的交互。
📦 安装指南
pip install transformers==4.45.0 accelerate opencv-python torchvision einops pillow
pip install git+https://github.com/bfshi/scaling_on_scales.git
💻 使用示例
基础用法
from transformers import AutoConfig, AutoModel
model_path = "turing-motors/Heron-NVILA-Lite-2B"
config = AutoConfig.from_pretrained(model_path, trust_remote_code=True)
model = AutoModel.from_config(config, trust_remote_code=True, device_map="auto")
model = AutoModel.from_pretrained(model_path, trust_remote_code=True, device_map="auto")
print(model.tokenizer.chat_template)
response = model.generate_content(["こんにちは"])
print(response)
print("---" * 40)
高级用法
文本 + 图像生成示例
from PIL import Image
import requests
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
response = model.generate_content([image, "画像を説明してください。"])
print(response)
print("---" * 40)
使用生成配置进行生成示例
from PIL import Image
import requests
from transformers import GenerationConfig
generation_config = {
"max_new_tokens": 512,
"temperature": 0.5,
"do_sample": True,
}
generation_config = GenerationConfig(**generation_config)
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
response = model.generate_content(
[image, "画像を説明してください。"],
generation_config=generation_config
)
print(response)
print("---" * 40)
多图像 + 文本生成示例
from PIL import Image
import requests
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, stream=True).raw).convert("RGB") for url in url_list
]
response = model.generate_content([
images[0],
"これは日本の画像です",
images[1],
"これはオーストリアの画像です",
"各画像の違いを説明して"])
print(response)
print("---" * 40)
📚 详细文档
模型概述
训练总结
评估
使用 llm-jp-eval-mm 进行评估。除 Heron-NVILA-Lite 和 Sarashina2-Vision-14B 之外的模型分数取自 2025 年 3 月的 llm-jp-eval-mm 排行榜 和 Asagi 网站。Heron-NVILA-Lite 和 Sarashina2-Vision-14B 使用 "gpt-4o-2024-05-13" 作为评估模型进行评估。Sarashina2-Vision-14B 在 官方博客 上使用 "gpt-4o-2024-08-06" 进行评估;请注意,由于评估条件不同,Sarashina2-Vision-14B 的结果仅作参考。
风险与限制
⚠️ 重要提示
该模型处于实验阶段,尚未针对道德合规性或法律标准进行全面校准。在敏感应用场景中使用时请谨慎。
许可证
致谢
该模型基于新能源产业技术综合开发机构(NEDO)资助的项目 JPNP20017 的研究成果。
感谢以下开源仓库的使用: