🚀 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 的研究成果。
感謝以下開源倉庫的使用: