File size: 5,971 Bytes
e8e6a82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
license: apache-2.0
language:
- ja
- en
pipeline_tag: image-to-text
---

## Model Description

**llava-calm2-siglip** is an experimental Vision Language Model that can answer questions in Japanese about images.

## Usage

<details>

```python
from PIL import Image
import requests
from transformers import AutoProcessor, LlavaForConditionalGeneration
import torch

model = LlavaForConditionalGeneration.from_pretrained(
    "cyberagent/llava-calm2-siglip",
    torch_dtype=torch.bfloat16,
).to(0)

processor = AutoProcessor.from_pretrained("cyberagent/llava-calm2-siglip")

prompt = """USER: <image>
ใ“ใฎ็”ปๅƒใ‚’่ชฌๆ˜Žใ—ใฆใใ ใ•ใ„ใ€‚
ASSISTANT: """

url = "https://unsplash.com/photos/LipkIP4fXbM/download?force=true&w=640"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")

inputs = processor(text=prompt, images=image, return_tensors="pt").to(0, torch.bfloat16)
generate_ids = model.generate(**inputs,
                              max_length=500,
                              do_sample=True,
                              temperature=0.2,
                    )
output = processor.tokenizer.decode(generate_ids[0][:-1], clean_up_tokenization_spaces=False)

print(output)

# USER: <image>
# ใ“ใฎ็”ปๅƒใ‚’่ชฌๆ˜Žใ—ใฆใใ ใ•ใ„ใ€‚
# ASSISTANT: ็”ปๅƒใซใฏใ€ๆœจ่ฃฝใฎใƒ†ใƒผใƒ–ใƒซใฎไธŠใซ็ฝฎใ‹ใ‚ŒใŸใ€ใŸใ“็„ผใๅ™จใง็„ผใ‹ใ‚ŒใŸ3ใคใฎใŸใ“็„ผใใŒๆ˜ ใฃใฆใ„ใพใ™ใ€‚ใŸใ“็„ผใใฏใ€ๅฐ้บฆ็ฒ‰ใ‚’ใƒ™ใƒผใ‚นใซใ—ใŸ็”Ÿๅœฐใ‚’ไธธใ็„ผใใ€ไธญใซใ‚ฟใ‚ณใ‚„ๅคฉใ‹ใ™ใ€็ด…ใ‚ทใƒงใ‚ฆใ‚ฌใชใฉใฎๅ…ทๆใ‚’ๅ…ฅใ‚ŒใŸใ‚‚ใฎใงใ™ใ€‚ใŸใ“็„ผใใฏใ€ใ‚ฝใƒผใ‚นใ€ใƒžใƒจใƒใƒผใ‚บใ€้’ๆตท่‹”ใ€ใ‹ใคใŠใถใ—ใ‚’ใ‹ใ‘ใฆ้ฃŸในใ‚‹ใ“ใจใŒๅคšใ„ใงใ™ใ€‚
```

</details>

## Chat Template
```
USER: <image>
{user_message1}
ASSISTANT: {assistant_message1}<|endoftext|>
USER: {user_message2}
ASSISTANT: {assistant_message2}<|endoftext|>
USER: {user_message3}
ASSISTANT: {assistant_message3}<|endoftext|>
```

## Model Details

* **Model size**: 7B
* **Model type**: Transformer-based Vision Language Model
* **Language(s)**: Japanese, English
* **Developed by**: [CyberAgent, Inc.](https://www.cyberagent.co.jp/)
* **License**: Apache-2.0

## Training

This model is a visual language instruction-following model based on [LLaVA 1.5](https://arxiv.org/abs/2310.03744). It utilizes [cyberagent/calm2-7b-chat](https://huggingface.co/cyberagent/calm2-7b-chat) as its language model and [google/siglip-so400m-patch14-384](https://huggingface.co/google/siglip-so400m-patch14-384) as its image encoder. During training, the first stage involved learning the MLP projection from scratch, which was followed by additional training of both the language model and the MLP projection in the second stage.

## Dataset for Visual Instruction Tuning
In the second stage of Visual Instruction Tuning, we train on a dataset of conversations about images. These conversational data are generated using our in-house large-scale Japanese language model, based on images, captions, object labels, and bounding boxes from the [MS-COCO](https://cocodataset.org/#home) and [VisualGenome](https://homes.cs.washington.edu/~ranjay/visualgenome/index.html). For methods of generating conversational datasets for Visual Instruction Tuning without using images, please refer to [LLaVA 1.5](https://arxiv.org/abs/2310.03744).

## Evaluation Results

### LLaVA Bench In-the-wild
| Model | Detail | Conv | Complex |  Average |
| - | -: | -: | -: | -: |
| [llava-calm2-siglip](https://huggingface.co/cyberagent/llava-calm2-siglip) | **51.2** | 55.9 | **65.51** | **57.54** |
| [Japanese Stable VLM](https://huggingface.co/stabilityai/japanese-stable-vlm) | 26.02  | 24.84 | 29.18 | 26.68 |
| [SakanaAI EvoVLM-JP](https://huggingface.co/SakanaAI/EvoVLM-JP-v1-7B) | 49.59 | **65.49** | 54.22 | 56.43 |
| [Heron BLIP v1 (620k)](https://huggingface.co/turing-motors/heron-chat-blip-ja-stablelm-base-7b-v1-llava-620k) | 45.45 | 32.90 | 56.89 | 45.08 |
| [Heron GIT](https://huggingface.co/turing-motors/heron-chat-git-ja-stablelm-base-7b-v1) | 40.98 | 39.87 | 54.59 | 45.15 |
- [LLaVA Bench In-the-wild](https://huggingface.co/datasets/liuhaotian/llava-bench-in-the-wild) translated into Japanese.

### Heron-Bench
| Model | Detail | Conv | Complex | Average  |
| - | -: | -: | -: | -: |
| [llava-calm2-siglip](https://huggingface.co/cyberagent/llava-calm2-siglip) | **53.42** | 50.13 | **52.72** | **52.09** |
| [Japanese Stable VLM](https://huggingface.co/stabilityai/japanese-stable-vlm) | 25.15 | 51.23 | 37.84 | 38.07 |
| [SakanaAI EvoVLM-JP](https://huggingface.co/SakanaAI/EvoVLM-JP-v1-7B) | 50.31 | 44.42 | 40.47 | 45.07 |
| [Heron BLIP v1 (620k)](https://huggingface.co/turing-motors/heron-chat-blip-ja-stablelm-base-7b-v1-llava-620k) | 49.09 | 41.51 | 45.72 | 45.44 |
| [Heron GIT](https://huggingface.co/turing-motors/heron-chat-git-ja-stablelm-base-7b-v1) | 42.77 | **54.20** | 43.53 | 46.83 |
- [Heron-Bench](https://huggingface.co/datasets/turing-motors/Japanese-Heron-Bench)

## Use and Limitations

### Intended Use

This model is designed for use by the open-source community in vision-language applications and academic research.

### Limitations and biases

This model, a general-purpose Japanese VLM, reaches optimal performance when specifically tuned with relevant data for each task.
Though technically possible, commercial use is advised with caution, and the implementation of mechanisms to filter out inappropriate content is strongly recommended when deployed in production systems.
This model is not advisable for use in applications that could potentially harm individuals or groups, or cause distress.
CyberAgent expressly disclaims any liability for direct, indirect, special, incidental, or consequential damages, as well as for any losses that may result from using this model, regardless of the outcomes.
Users must fully understand these limitations before employing the model.

## Author

[Aozora Inagaki](https://huggingface.co/bluezora)