Views
No views yet
[!NOTE] We have released Heron-NVILA-Lite-1B-hf, an implementation compatible withtransformers.AutoModelForImageTextToText.
1# I have confirmed that 4.46.0 and 4.49.0 also work. Other versions of Transformer may also work, but I have not tested them.
2pip install transformers==4.45.0 accelerate opencv-python torchvision einops pillow
3pip install git+https://github.com/bfshi/scaling_on_scales.git1from transformers import AutoConfig, AutoModel
2
3model_path = "turing-motors/Heron-NVILA-Lite-1B"
4
5# you can use config
6config = AutoConfig.from_pretrained(model_path, trust_remote_code=True)
7model = AutoModel.from_config(config, trust_remote_code=True, device_map="auto")
8
9# or directly from_pretrained
10model = AutoModel.from_pretrained(model_path, trust_remote_code=True, device_map="auto")
11
12# show chat_template
13print(model.tokenizer.chat_template)
14
15# examples generate with raw text
16response = model.generate_content(["こんにちは"])
17print(response)
18print("---" * 40)
19
20# examples generate with text + image
21from PIL import Image
22import requests
23url = "http://images.cocodataset.org/val2017/000000039769.jpg"
24image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
25response = model.generate_content([image, "画像を説明してください。"])
26print(response)
27print("---" * 40)
28
29# examples generate using generation_config
30from PIL import Image
31import requests
32from transformers import GenerationConfig
33generation_config = {
34 "max_new_tokens": 512,
35 "temperature": 0.5,
36 "do_sample": True,
37}
38generation_config = GenerationConfig(**generation_config)
39url = "http://images.cocodataset.org/val2017/000000039769.jpg"
40image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
41response = model.generate_content(
42 [image, "画像を説明してください。"],
43 generation_config=generation_config
44)
45print(response)
46print("---" * 40)
47
48# examples generate with text + image + text + image + text
49from PIL import Image
50import requests
51url_list = [
52 "https://images.unsplash.com/photo-1694831404826-3400c48c188d?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
53 "https://images.unsplash.com/photo-1693240876439-473af88b4ed7?q=80&w=1974&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
54]
55images = [
56 Image.open(requests.get(url, stream=True).raw).convert("RGB") for url in url_list
57]
58response = model.generate_content([
59 images[0],
60 "これは日本の画像です",
61 images[1],
62 "これはオーストリアの画像です",
63 "各画像の違いを説明して"])
64print(response)
65print("---" * 40)| Stage | Training | Data Sources | Samples |
|---|---|---|---|
| Stage1 | Projector | Japanese image text pairs, LLaVA-Pretrain | 1.1M |
| Stage2 | Projector, LLM | Filtered MOMIJI (CC-MAIN-2024-46, CC-MAIN-2024-51, CC-MAIN-2025-05) | 13M |
| Japanese image text pairs (subset), Japanese interleaved data (subset), mmc4-core (subset), coyo-700m (subset), wikipedia_ja, llava_pretrain_ja, stair_captions | 20M | ||
| Stage3 | Vision Encoder, Projector, LLM | llava-instruct-v1_5-en-subset-358k, llava-instruct-ja, japanese-photos-conv, ja-vg-vqa, synthdog-ja (subset), ai2d, synthdog-en, sherlock | 1.1M |
| Model | LLM Size | Heron-Bench overall LLM (%) | JA-VLM-Bench-In-the-Wild LLM (/5.0) | JA-VG-VQA-500 LLM (/5.0) |
|---|---|---|---|---|
| Heron-NVILA-Lite-1B | 0.5B | 45.9 | 2.92 | 3.16 |
| Heron-NVILA-Lite-2B | 1.5B | 52.8 | 3.52 | 3.50 |
| Heron-NVILA-Lite-15B | 14B | 59.6 | 4.2 | 3.82 |
| LLaVA-CALM2-SigLIP | 7B | 43.3 | 3.15 | 3.21 |
| Llama-3-EvoVLM-JP-v2 | 8B | 39.3 | 2.92 | 2.96 |
| VILA-jp | 13B | 57.2 | 3.69 | 3.62 |
| Asagi-14B | 13B | 55.8 | 3.44 | 3.84 |
| Sarashina2-Vision-14B | 13B | 50.9 | 4.1 | 3.43 |
| Qwen2-VL 7B Instruct | 7B | 55.5 | 3.61 | 3.6 |
| GPT-4o | - | 87.6 | 3.85 | 3.58 |