czczup commited on
Commit
59cbc1d
1 Parent(s): df93aa1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +107 -0
README.md CHANGED
@@ -1,3 +1,110 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-Chat-Chinese-V1.2
13
+
14
+ ## What is InternVL?
15
+
16
+ \[[Paper](https://arxiv.org/abs/2312.14238)\] \[[GitHub](https://github.com/OpenGVLab/InternVL)\] \[[Chat Demo](https://internvl.opengvlab.com/)\]
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
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/64119264f0f81eb569e0d569/4SynvLt2qH8JXFQVI_fmv.png)
23
+
24
+ ## Model Details
25
+ - **Model Type:** vision large language model, multimodal chatbot
26
+ - **Model Stats:**
27
+ - Architecture: [InternViT-6B-448px-V1-2](https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-2) + MLP + [Nous-Hermes-2-Yi-34B](https://huggingface.co/NousResearch/Nous-Hermes-2-Yi-34B)
28
+ - Params: 40B
29
+ - Image size: 448 x 448
30
+ - Number of visual tokens: 256
31
+
32
+ - **Training Strategy:**
33
+ - Pretraining Stage
34
+ - Learnable Component: MLP
35
+ - Data: Trained on 8192x4800=39.3M samples, including COYO, LAION, CC12M, CC3M, SBU, Wukong, GRIT, Objects365, OpenImages, and OCR data.
36
+ - Note: In this stage, we load the pretrained weights of [InternViT-6B-448px-V1-2](https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-2). Moreover, in order to reduce the number of visual tokens, we use a pixel shuffle to reduce 1024 tokens to 256 tokens.
37
+ - SFT Stage
38
+ - Learnable Component: ViT + MLP + LLM
39
+ - Data: A simplified, fully open-source dataset, containing approximately 1 million entries.
40
+ -
41
+
42
+ ## Model Usage
43
+
44
+ We provide a minimum code example to run InternVL-Chat using only the `transformers` library.
45
+
46
+ You also can use our [online demo](https://internvl.opengvlab.com/) for a quick experience of this model.
47
+
48
+ Note: If you meet this error `ImportError: This modeling file requires the following packages that were not found in your environment: fastchat`, please run `pip install fschat`.
49
+
50
+
51
+ ```python
52
+ import torch
53
+ from PIL import Image
54
+ from transformers import AutoModel, CLIPImageProcessor
55
+ from transformers import AutoTokenizer
56
+
57
+ path = "OpenGVLab/InternVL-Chat-Chinese-V1-2"
58
+ model = AutoModel.from_pretrained(
59
+ path,
60
+ torch_dtype=torch.bfloat16,
61
+ low_cpu_mem_usage=True,
62
+ trust_remote_code=True,
63
+ device_map='auto').eval()
64
+
65
+ tokenizer = AutoTokenizer.from_pretrained(path)
66
+ image = Image.open('./examples/image2.jpg').convert('RGB')
67
+ image = image.resize((448, 448))
68
+ image_processor = CLIPImageProcessor.from_pretrained(path)
69
+
70
+ pixel_values = image_processor(images=image, return_tensors='pt').pixel_values
71
+ pixel_values = pixel_values.to(torch.bfloat16).cuda()
72
+
73
+ generation_config = dict(
74
+ num_beams=1,
75
+ max_new_tokens=512,
76
+ do_sample=False,
77
+ )
78
+
79
+ question = "请详细描述图片"
80
+ response = model.chat(tokenizer, pixel_values, question, generation_config)
81
+ ```
82
+
83
+
84
+ ## Evaluation
85
+
86
+ TODO
87
+
88
+
89
+ ## Citation
90
+
91
+ If you find this project useful in your research, please consider citing:
92
+
93
+ ```BibTeX
94
+ @article{chen2023internvl,
95
+ title={InternVL: Scaling up Vision Foundation Models and Aligning for Generic Visual-Linguistic Tasks},
96
+ 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},
97
+ journal={arXiv preprint arXiv:2312.14238},
98
+ year={2023}
99
+ }
100
+ ```
101
+
102
+ ## License
103
+
104
+ This project is released under the MIT license. Parts of this project contain code and models (e.g., LLaMA2) from other sources, which are subject to their respective licenses.
105
+
106
+ Llama 2 is licensed under the LLAMA 2 Community License, Copyright (c) Meta Platforms, Inc. All Rights Reserved.
107
+
108
+ ## Acknowledgement
109
+
110
+ 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!