Update README.md
Browse files
README.md
CHANGED
@@ -1,7 +1,34 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
```python
|
6 |
import torch
|
7 |
from PIL import Image
|
@@ -55,4 +82,39 @@ probs = logits_per_image.softmax(dim=-1)
|
|
55 |
# [8.6060e-03, 9.9219e-01, 2.8759e-06],
|
56 |
# [1.7583e-06, 3.1233e-05, 1.0000e+00]], device='cuda:0',
|
57 |
# dtype=torch.bfloat16, grad_fn=<SoftmaxBackward0>)
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
datasets:
|
4 |
+
- laion/laion2B-en
|
5 |
+
- laion/laion-coco
|
6 |
+
- laion/laion2B-multi
|
7 |
+
- kakaobrain/coyo-700m
|
8 |
+
- conceptual_captions
|
9 |
+
- wanng/wukong100m
|
10 |
---
|
11 |
|
12 |
+
# Model Card for InternVL-14B-224px
|
13 |
+
|
14 |
+
## What is InternVL?
|
15 |
+
|
16 |
+
\[[Paper](https://arxiv.org/abs/2312.14238)\] \[[GitHub](https://github.com/OpenGVLab/InternVL)\]
|
17 |
+
|
18 |
+
InternVL scales up the ViT to _**6B parameters**_ and aligns it with LLM.
|
19 |
+
|
20 |
+
It is _**the largest open-source vision/vision-language foundation model (14B)**_ to date, achieving _**32 state-of-the-art**_ performances on a wide range of tasks such as visual perception, cross-modal retrieval, multimodal dialogue, etc.
|
21 |
+
|
22 |
+
|
23 |
+
## Model Details
|
24 |
+
- **Model Type:** vision-language foundation model
|
25 |
+
- **Model Stats:**
|
26 |
+
- Params (M): 14B
|
27 |
+
- Image size: 224 x 224
|
28 |
+
- **Pretrain Dataset:** LAION-en, LAION-COCO, COYO, CC12M, CC3M, SBU, Wukong, LAION-multi
|
29 |
+
|
30 |
+
## Model Usage
|
31 |
+
|
32 |
```python
|
33 |
import torch
|
34 |
from PIL import Image
|
|
|
82 |
# [8.6060e-03, 9.9219e-01, 2.8759e-06],
|
83 |
# [1.7583e-06, 3.1233e-05, 1.0000e+00]], device='cuda:0',
|
84 |
# dtype=torch.bfloat16, grad_fn=<SoftmaxBackward0>)
|
85 |
+
|
86 |
+
# please set add_eos_token to False for generation
|
87 |
+
tokenizer.add_eos_token = False
|
88 |
+
image = Image.open('./examples/image1.jpg').convert('RGB')
|
89 |
+
pixel_values = image_processor(images=image, return_tensors='pt').pixel_values
|
90 |
+
pixel_values = pixel_values.to(torch.bfloat16).cuda()
|
91 |
+
|
92 |
+
tokenized = tokenizer("English caption:", return_tensors='pt')
|
93 |
+
pred = model.generate(
|
94 |
+
pixel_values=pixel_values,
|
95 |
+
input_ids=tokenized.input_ids.cuda(),
|
96 |
+
attention_mask=tokenized.attention_mask.cuda(),
|
97 |
+
num_beams=5,
|
98 |
+
min_new_tokens=8,
|
99 |
+
)
|
100 |
+
caption = tokenizer.decode(pred[0].cpu(), skip_special_tokens=True).strip()
|
101 |
+
# English caption: a red panda sitting on top of a wooden platform
|
102 |
+
```
|
103 |
+
|
104 |
+
## Citation
|
105 |
+
|
106 |
+
If you find this project useful in your research, please consider cite:
|
107 |
+
|
108 |
+
```BibTeX
|
109 |
+
@article{chen2023internvl,
|
110 |
+
title={InternVL: Scaling up Vision Foundation Models and Aligning for Generic Visual-Linguistic Tasks},
|
111 |
+
author={Chen, Zhe and Wu, Jiannan and Wang, Wenhai and Su, Weijie and Chen, Guo and Xing, Sen and Zhong, Muyan and Zhang, Qinglong and Zhu, Xizhou and Lu, Lewei and Li, Bin and Luo, Ping and Lu, Tong and Qiao, Yu and Dai, Jifeng},
|
112 |
+
journal={arXiv preprint arXiv:2312.14238},
|
113 |
+
year={2023}
|
114 |
+
}
|
115 |
+
```
|
116 |
+
|
117 |
+
|
118 |
+
## Acknowledgement
|
119 |
+
|
120 |
+
InternVL is built with reference to the code of the following projects: [OpenAI CLIP](https://github.com/openai/CLIP), [Open CLIP](https://github.com/mlfoundations/open_clip), [CLIP Benchmark](https://github.com/LAION-AI/CLIP_benchmark), [EVA](https://github.com/baaivision/EVA/tree/master), [InternImage](https://github.com/OpenGVLab/InternImage), [ViT-Adapter](https://github.com/czczup/ViT-Adapter), [MMSegmentation](https://github.com/open-mmlab/mmsegmentation), [Transformers](https://github.com/huggingface/transformers), [DINOv2](https://github.com/facebookresearch/dinov2), [BLIP-2](https://github.com/salesforce/LAVIS/tree/main/projects/blip2), [Qwen-VL](https://github.com/QwenLM/Qwen-VL/tree/master/eval_mm), and [LLaVA-1.5](https://github.com/haotian-liu/LLaVA). Thanks for their awesome work!
|