File size: 2,856 Bytes
29c0bfe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
pipeline_tag: image-text-to-text
license: apache-2.0
license_link: https://huggingface.co/Qwen/Qwen2.5-72B-Instruct/blob/main/LICENSE
base_model: OpenGVLab/InternVL3-2B-hf
library_name: kerasformers
language:
- en
tags:
- keras
- kerasformers
- internvl
- internvl3
- multimodal
- vision
- image-text-to-text
- pytorch
- jax
- tf
license_name: qwen
---

# Run InternVL3 with Keras 3: JAX, PyTorch, or TensorFlow

[![GitHub](https://img.shields.io/badge/GitHub-KerasFormers-181717?logo=github)](https://github.com/IMvision12/KerasFormers) [![Docs](https://img.shields.io/badge/Docs-InternVL-1f6feb)](https://imvision12.github.io/KerasFormers/internvl/) [![HuggingFace](https://img.shields.io/badge/HuggingFace-InternVL-ffd21e?logo=huggingface&logoColor=black)](https://huggingface.co/collections/kerasformers/internvl-6a8277076dbb163f53241dbd)

# kerasformers/internvl3-2b

Pure-**Keras 3** conversion of [`OpenGVLab/InternVL3-2B-hf`](https://huggingface.co/OpenGVLab/InternVL3-2B-hf) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**. This is a **InternVL3** checkpoint, served as **image + text -> text** via `InternVLProcessor`; weights are stored in **bfloat16**.

For model details, license, and usage terms, see the upstream [model card](https://huggingface.co/OpenGVLab/InternVL3-2B-hf).

Paper: [InternVL3: Exploring Advanced Training and Test-Time Recipes for Open-Source Multimodal Models (arXiv:2504.10479)](https://arxiv.org/abs/2504.10479) · [HF Papers](https://huggingface.co/papers/2504.10479)

Paper: [Qwen2.5 Technical Report (arXiv:2412.15115)](https://arxiv.org/abs/2412.15115) · [HF Papers](https://huggingface.co/papers/2412.15115)

## ✨ Quick start

```python

import os

os.environ["KERAS_BACKEND"] = "torch"  # or "jax" / "tensorflow"

from PIL import Image

from kerasformers.models.internvl import InternVLConditionalGenerate, InternVLProcessor

model = InternVLConditionalGenerate.from_weights("kerasformers/internvl3-2b")

processor = InternVLProcessor.from_weights("kerasformers/internvl3-2b")

inputs = processor(conversation=[

    {"role": "user", "content": [

        {"type": "image", "image": Image.open("photo.jpg")},

        {"type": "text", "text": "Describe this image in one sentence."},

    ]}

])

outputs = model.generate(**inputs, max_new_tokens=64)

print(processor.decode(outputs[0]))

```

Load any InternVL variant the same way with `from_weights("kerasformers/<variant>")`. Browse them all in the [InternVL collection](https://huggingface.co/collections/kerasformers/internvl-6a8277076dbb163f53241dbd).

## Special Thanks

A huge thank you to the OpenGVLab team for creating and releasing the InternVL models.

License: see the [upstream license](https://huggingface.co/OpenGVLab/InternVL3-2B-hf/blob/main/LICENSE).