Improve model card: Add project page link and update pipeline tag capitalization

#1
by nielsr HF Staff - opened
Files changed (1) hide show
  1. README.md +113 -34
README.md CHANGED
@@ -1,25 +1,25 @@
1
  ---
2
- license: apache-2.0
3
- pipeline_tag: image-text-to-text
4
- library_name: transformers
5
  base_model:
6
- - OpenGVLab/InternVL3_5-2B-MPO
7
- base_model_relation: finetune
8
  datasets:
9
- - OpenGVLab/MMPR-v1.2
10
- - OpenGVLab/MMPR-Tiny
11
  language:
12
- - multilingual
 
 
 
13
  tags:
14
- - internvl
15
- - custom_code
 
16
  ---
17
 
18
  # InternVL3_5-2B
19
 
20
  [\[📂 GitHub\]](https://github.com/OpenGVLab/InternVL) [\[📜 InternVL 1.0\]](https://huggingface.co/papers/2312.14238) [\[📜 InternVL 1.5\]](https://huggingface.co/papers/2404.16821) [\[📜 InternVL 2.5\]](https://huggingface.co/papers/2412.05271) [\[📜 InternVL2.5-MPO\]](https://huggingface.co/papers/2411.10442) [\[📜 InternVL3\]](https://huggingface.co/papers/2504.10479) [\[📜 InternVL3.5\]](https://huggingface.co/papers/2508.18265)
21
 
22
- [\[🆕 Blog\]](https://internvl.github.io/blog/) [\[🗨️ Chat Demo\]](https://chat.intern-ai.org.cn/) [\[🚀 Quick Start\]](#quick-start) [\[📖 Documents\]](https://internvl.readthedocs.io/en/latest/)
23
 
24
  <div align="center">
25
  <img width="500" alt="image" src="https://cdn-uploads.huggingface.co/production/uploads/64006c09330a45b03605bba3/zJsd2hqd3EevgXo6fNgC-.png">
@@ -233,7 +233,7 @@ $$
233
  \Bigg],
234
  $$
235
 
236
- where \\(\mathrm{KL}\) denotes the KL divergence and \(\xi\) denotes the compression rate, which is uniformly sampled from \(\{\frac{1}{4},\frac{1}{16}\}\). The image \(I_\xi\) is represented as 256 tokens when \(\xi=\frac{1}{4}\) and 64 tokens when \(\xi=\frac{1}{16}\). Notably, the reference model always performs inference with \(\xi=\frac{1}{4}\).
237
 
238
 
239
  `Router training`:
@@ -529,40 +529,50 @@ generation_config = dict(max_new_tokens=1024, do_sample=True)
529
  # pure-text conversation (纯文本对话)
530
  question = 'Hello, who are you?'
531
  response, history = model.chat(tokenizer, None, question, generation_config, history=None, return_history=True)
532
- print(f'User: {question}\nAssistant: {response}')
 
533
 
534
  question = 'Can you tell me a story?'
535
  response, history = model.chat(tokenizer, None, question, generation_config, history=history, return_history=True)
536
- print(f'User: {question}\nAssistant: {response}')
 
537
 
538
  # single-image single-round conversation (单图单轮对话)
539
- question = '<image>\nPlease describe the image shortly.'
 
540
  response = model.chat(tokenizer, pixel_values, question, generation_config)
541
- print(f'User: {question}\nAssistant: {response}')
 
542
 
543
  # single-image multi-round conversation (单图多轮对话)
544
- question = '<image>\nPlease describe the image in detail.'
 
545
  response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=None, return_history=True)
546
- print(f'User: {question}\nAssistant: {response}')
 
547
 
548
  question = 'Please write a poem according to the image.'
549
  response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=history, return_history=True)
550
- print(f'User: {question}\nAssistant: {response}')
 
551
 
552
  # multi-image multi-round conversation, combined images (多图多轮对话,拼接图像)
553
  pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
554
  pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
555
  pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
556
 
557
- question = '<image>\nDescribe the two images in detail.'
 
558
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
559
  history=None, return_history=True)
560
- print(f'User: {question}\nAssistant: {response}')
 
561
 
562
  question = 'What are the similarities and differences between these two images.'
563
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
564
  history=history, return_history=True)
565
- print(f'User: {question}\nAssistant: {response}')
 
566
 
567
  # multi-image multi-round conversation, separate images (多图多轮对话,独立图像)
568
  pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
@@ -570,17 +580,20 @@ pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat1
570
  pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
571
  num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
572
 
573
- question = 'Image-1: <image>\nImage-2: <image>\nDescribe the two images in detail.'
 
 
574
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
575
  num_patches_list=num_patches_list,
576
  history=None, return_history=True)
577
- print(f'User: {question}\nAssistant: {response}')
 
578
 
579
  question = 'What are the similarities and differences between these two images.'
580
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
581
- num_patches_list=num_patches_list,
582
- history=history, return_history=True)
583
- print(f'User: {question}\nAssistant: {response}')
584
 
585
  # batch inference, single image per sample (单图批处理)
586
  pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
@@ -588,13 +601,15 @@ pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat1
588
  num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
589
  pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
590
 
591
- questions = ['<image>\nDescribe the image in detail.'] * len(num_patches_list)
 
592
  responses = model.batch_chat(tokenizer, pixel_values,
593
  num_patches_list=num_patches_list,
594
  questions=questions,
595
  generation_config=generation_config)
596
  for question, response in zip(questions, responses):
597
- print(f'User: {question}\nAssistant: {response}')
 
598
 
599
  # video multi-round conversation (视频多轮对话)
600
  def get_index(bound, fps, max_frame, first_idx=0, num_segments=32):
@@ -632,17 +647,24 @@ def load_video(video_path, bound=None, input_size=448, max_num=1, num_segments=3
632
  video_path = './examples/red-panda.mp4'
633
  pixel_values, num_patches_list = load_video(video_path, num_segments=8, max_num=1)
634
  pixel_values = pixel_values.to(torch.bfloat16).cuda()
635
- video_prefix = ''.join([f'Frame{i+1}: <image>\n' for i in range(len(num_patches_list))])
 
636
  question = video_prefix + 'What is the red panda doing?'
637
- # Frame1: <image>\nFrame2: <image>\n...\nFrame8: <image>\n{question}
 
 
 
 
638
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
639
  num_patches_list=num_patches_list, history=None, return_history=True)
640
- print(f'User: {question}\nAssistant: {response}')
 
641
 
642
  question = 'Describe this video in detail.'
643
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
644
  num_patches_list=num_patches_list, history=history, return_history=True)
645
- print(f'User: {question}\nAssistant: {response}')
 
646
  ```
647
 
648
  #### Streaming Output
@@ -726,7 +748,9 @@ image_urls=[
726
 
727
  images = [load_image(img_url) for img_url in image_urls]
728
  # Numbering images improves multi-image conversations
729
- response = pipe((f'Image-1: {IMAGE_TOKEN}\nImage-2: {IMAGE_TOKEN}\ndescribe these two images', images))
 
 
730
  print(response.text)
731
  ```
732
 
@@ -828,4 +852,59 @@ If you find this project useful in your research, please consider citing:
828
  journal={arXiv preprint arXiv:2508.18265},
829
  year={2025}
830
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
831
  ```
 
 
 
 
 
 
 
 
 
 
 
1
  ---
 
 
 
2
  base_model:
3
+ - OpenGVLab/InternVL3_5-2B-MPO
 
4
  datasets:
5
+ - OpenGVLab/MMPR-v1.2
6
+ - OpenGVLab/MMPR-Tiny
7
  language:
8
+ - multilingual
9
+ library_name: transformers
10
+ license: apache-2.0
11
+ pipeline_tag: IMAGE_TEXT_TO_TEXT
12
  tags:
13
+ - internvl
14
+ - custom_code
15
+ base_model_relation: finetune
16
  ---
17
 
18
  # InternVL3_5-2B
19
 
20
  [\[📂 GitHub\]](https://github.com/OpenGVLab/InternVL) [\[📜 InternVL 1.0\]](https://huggingface.co/papers/2312.14238) [\[📜 InternVL 1.5\]](https://huggingface.co/papers/2404.16821) [\[📜 InternVL 2.5\]](https://huggingface.co/papers/2412.05271) [\[📜 InternVL2.5-MPO\]](https://huggingface.co/papers/2411.10442) [\[📜 InternVL3\]](https://huggingface.co/papers/2504.10479) [\[📜 InternVL3.5\]](https://huggingface.co/papers/2508.18265)
21
 
22
+ [\[🏠 Project Page\]](https://huggingface.co/spaces/OpenGVLab/InternVL) [\[🆕 Blog\]](https://internvl.github.io/blog/) [\[🗨️ Chat Demo\]](https://chat.intern-ai.org.cn/) [\[🚀 Quick Start\]](#quick-start) [\[📖 Documents\]](https://internvl.readthedocs.io/en/latest/)
23
 
24
  <div align="center">
25
  <img width="500" alt="image" src="https://cdn-uploads.huggingface.co/production/uploads/64006c09330a45b03605bba3/zJsd2hqd3EevgXo6fNgC-.png">
 
233
  \Bigg],
234
  $$
235
 
236
+ where \\(\mathrm{KL}\\) denotes the KL divergence and \(\xi\) denotes the compression rate, which is uniformly sampled from \(\{\frac{1}{4},\frac{1}{16}\}\). The image \(I_\xi\) is represented as 256 tokens when \(\xi=\frac{1}{4}\) and 64 tokens when \(\xi=\frac{1}{16}\). Notably, the reference model always performs inference with \(\xi=\frac{1}{4}\).
237
 
238
 
239
  `Router training`:
 
529
  # pure-text conversation (纯文本对话)
530
  question = 'Hello, who are you?'
531
  response, history = model.chat(tokenizer, None, question, generation_config, history=None, return_history=True)
532
+ print(f'User: {question}
533
+ Assistant: {response}')
534
 
535
  question = 'Can you tell me a story?'
536
  response, history = model.chat(tokenizer, None, question, generation_config, history=history, return_history=True)
537
+ print(f'User: {question}
538
+ Assistant: {response}')
539
 
540
  # single-image single-round conversation (单图单轮对话)
541
+ question = '<image>
542
+ Please describe the image shortly.'
543
  response = model.chat(tokenizer, pixel_values, question, generation_config)
544
+ print(f'User: {question}
545
+ Assistant: {response}')
546
 
547
  # single-image multi-round conversation (单图多轮对话)
548
+ question = '<image>
549
+ Please describe the image in detail.'
550
  response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=None, return_history=True)
551
+ print(f'User: {question}
552
+ Assistant: {response}')
553
 
554
  question = 'Please write a poem according to the image.'
555
  response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=history, return_history=True)
556
+ print(f'User: {question}
557
+ Assistant: {response}')
558
 
559
  # multi-image multi-round conversation, combined images (多图多轮对话,拼接图像)
560
  pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
561
  pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
562
  pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
563
 
564
+ question = '<image>
565
+ Describe the two images in detail.'
566
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
567
  history=None, return_history=True)
568
+ print(f'User: {question}
569
+ Assistant: {response}')
570
 
571
  question = 'What are the similarities and differences between these two images.'
572
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
573
  history=history, return_history=True)
574
+ print(f'User: {question}
575
+ Assistant: {response}')
576
 
577
  # multi-image multi-round conversation, separate images (多图多轮对话,独立图像)
578
  pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
 
580
  pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
581
  num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
582
 
583
+ question = 'Image-1: <image>
584
+ Image-2: <image>
585
+ Describe the two images in detail.'
586
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
587
  num_patches_list=num_patches_list,
588
  history=None, return_history=True)
589
+ print(f'User: {question}
590
+ Assistant: {response}')
591
 
592
  question = 'What are the similarities and differences between these two images.'
593
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
594
+ num_patches_list=num_patches_list, history=history, return_history=True)
595
+ print(f'User: {question}
596
+ Assistant: {response}')
597
 
598
  # batch inference, single image per sample (单图批处理)
599
  pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
 
601
  num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
602
  pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
603
 
604
+ questions = ['<image>
605
+ Describe the image in detail.'] * len(num_patches_list)
606
  responses = model.batch_chat(tokenizer, pixel_values,
607
  num_patches_list=num_patches_list,
608
  questions=questions,
609
  generation_config=generation_config)
610
  for question, response in zip(questions, responses):
611
+ print(f'User: {question}
612
+ Assistant: {response}')
613
 
614
  # video multi-round conversation (视频多轮对话)
615
  def get_index(bound, fps, max_frame, first_idx=0, num_segments=32):
 
647
  video_path = './examples/red-panda.mp4'
648
  pixel_values, num_patches_list = load_video(video_path, num_segments=8, max_num=1)
649
  pixel_values = pixel_values.to(torch.bfloat16).cuda()
650
+ video_prefix = ''.join([f'Frame{i+1}: <image>
651
+ ' for i in range(len(num_patches_list))])
652
  question = video_prefix + 'What is the red panda doing?'
653
+ # Frame1: <image>
654
+ Frame2: <image>
655
+ ...
656
+ Frame8: <image>
657
+ {question}
658
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
659
  num_patches_list=num_patches_list, history=None, return_history=True)
660
+ print(f'User: {question}
661
+ Assistant: {response}')
662
 
663
  question = 'Describe this video in detail.'
664
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
665
  num_patches_list=num_patches_list, history=history, return_history=True)
666
+ print(f'User: {question}
667
+ Assistant: {response}')
668
  ```
669
 
670
  #### Streaming Output
 
748
 
749
  images = [load_image(img_url) for img_url in image_urls]
750
  # Numbering images improves multi-image conversations
751
+ response = pipe((f'Image-1: {IMAGE_TOKEN}
752
+ Image-2: {IMAGE_TOKEN}
753
+ describe these two images', images))
754
  print(response.text)
755
  ```
756
 
 
852
  journal={arXiv preprint arXiv:2508.18265},
853
  year={2025}
854
  }
855
+ @article{zhu2025internvl3,
856
+ title={Internvl3: Exploring advanced training and test-time recipes for open-source multimodal models},
857
+ author={Zhu, Jinguo and Wang, Weiyun and Chen, Zhe and Liu, Zhaoyang and Ye, Shenglong and Gu, Lixin and Tian, Hao and Duan, Yuchen and Su, Weijie and Shao, Jie and others},
858
+ journal={arXiv preprint arXiv:2504.10479},
859
+ year={2025}
860
+ }
861
+ @article{chen2024expanding,
862
+ title={Expanding Performance Boundaries of Open-Source Multimodal Models with Model, Data, and Test-Time Scaling},
863
+ author={Chen, Zhe and Wang, Weiyun and Cao, Yue and Liu, Yangzhou and Gao, Zhangwei and Cui, Erfei and Zhu, Jinguo and Ye, Shenglong and Tian, Hao and Liu, Zhaoyang and others},
864
+ journal={arXiv preprint arXiv:2412.05271},
865
+ year={2024}
866
+ }
867
+ @article{wang2024mpo,
868
+ title={Enhancing the Reasoning Ability of Multimodal Large Language Models via Mixed Preference Optimization},
869
+ author={Wang, Weiyun and Chen, Zhe and Wang, Wenhai and Cao, Yue and Liu, Yangzhou and Gao, Zhangwei and Zhu, Jinguo and Zhu, Xizhou and Lu, Lewei and Qiao, Yu and Dai, Jifeng},
870
+ journal={arXiv preprint arXiv:2411.10442},
871
+ year={2024}
872
+ }
873
+ @article{gao2024mini,
874
+ title={Mini-InternVL: a flexible-transfer pocket multi-modal model with 5\% parameters and 90\% performance},
875
+ author={Gao, Zhangwei and Chen, Zhe and Cui, Erfei and Ren, Yiming and Wang, Weiyun and Zhu, Jinguo and Tian, Hao and Ye, Shenglong and He, Junjun and Zhu, Xizhou and others},
876
+ journal={Visual Intelligence},
877
+ volume={2},
878
+ number={1},
879
+ pages={1--17},
880
+ year={2024},
881
+ publisher={Springer}
882
+ }
883
+ @article{chen2024far,
884
+ title={How far are we to gpt-4v? closing the gap to commercial multimodal models with open-source suites},
885
+ author={Chen, Zhe and Wang, Weiyun and Tian, Hao and Ye, Shenglong and Gao, Zhangwei and Cui, Erfei and Tong, Wenwen and Hu, Kongzhi and Luo, Jiapeng and Ma, Zheng and others},
886
+ journal={Science China Information Sciences},
887
+ volume={67},
888
+ number={12},
889
+ pages={220101},
890
+ year={2024},
891
+ publisher={Springer}
892
+ }
893
+ @inproceedings{chen2024internvl,
894
+ title={Internvl: Scaling up vision foundation models and aligning for generic visual-linguistic tasks},
895
+ 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 others},
896
+ booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
897
+ pages={24185--24198},
898
+ year={2024}
899
+ }
900
  ```
901
+
902
+ ## Acknowledgement
903
+
904
+ 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!
905
+
906
+ ______________________________________________________________________
907
+
908
+ Scan the following QR Code, join our WeChat group.
909
+
910
+ <p align="center"><img width="300" alt="image" src="https://github.com/user-attachments/assets/f776df09-ebba-4fd5-80c2-fec4ff1518be"></p>