kkk5 commited on
Commit
a7b48bb
·
verified ·
1 Parent(s): 1076b3d

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +56 -3
README.md CHANGED
@@ -1,3 +1,56 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - Qwen/Qwen2-VL-7B-Instruct
5
+ pipeline_tag: image-text-to-text
6
+ tags:
7
+ - image-captioning
8
+ - reinforcement-learning
9
+ - GRPO
10
+ ---
11
+
12
+ # CIM-Qwen2-VL-7B-SFT
13
+
14
+ This model is fine-tuned from [Qwen2-VL-7B-Instruct](https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct) using **SFT + GRPO** with the **Cross-modal Identity Mapping (CIM)** reward, as described in our CVPR 2026 paper.
15
+
16
+ [![arXiv](https://img.shields.io/badge/cs.CV-2603.01696-b31b1b?logo=arxiv&logoColor=red)](https://arxiv.org/abs/2603.01696)
17
+ [![GitHub](https://img.shields.io/badge/GitHub-CIM-blue?logo=github)](https://github.com/Jia-hn/CIM)
18
+
19
+ ## Overview
20
+
21
+ CIM is a reinforcement learning framework that improves image captioning by minimizing information loss during modality conversion. It uses two reward signals — **Gallery Representation Consistency (GRC)** and **Query-gallery Image Relevance (QIR)** — to encourage LVLMs to generate fine-grained and precise captions without extra annotations.
22
+
23
+ ## Usage
24
+
25
+ ```python
26
+ from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
27
+ from qwen_vl_utils import process_vision_info
28
+
29
+ model = Qwen2VLForConditionalGeneration.from_pretrained("kkk5/CIM-Qwen2-VL-7B-SFT", torch_dtype="auto", device_map="auto")
30
+ processor = AutoProcessor.from_pretrained("kkk5/CIM-Qwen2-VL-7B-SFT")
31
+
32
+ messages = [{"role": "user", "content": [
33
+ {"type": "image", "image": "your_image.jpg"},
34
+ {"type": "text", "text": "Caption this image as accurately as possible, without speculation. Describe what you see."},
35
+ ]}]
36
+
37
+ text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
38
+ image_inputs, video_inputs = process_vision_info(messages)
39
+ inputs = processor(text=[text], images=image_inputs, videos=video_inputs, padding=True, return_tensors="pt").to(model.device)
40
+
41
+ output_ids = model.generate(**inputs, max_new_tokens=1024)
42
+ output_text = processor.batch_decode(output_ids[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)[0]
43
+ print(output_text)
44
+ ```
45
+
46
+ ## Citation
47
+
48
+ ```bibtex
49
+ @inproceedings{jia2026cross,
50
+ title = {Cross-modal Identity Mapping: Minimizing Information Loss in Modality Conversion via Reinforcement Learning},
51
+ author = {Jia, Haonan and Dong, Shichao and Dong, Xin and Sun, Zenghui and Wang, Jin and Lan, Jinsong and Zhu, Xiaoyong and Zheng, Bo and Zhang, Kaifu},
52
+ booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
53
+ pages = {766--777},
54
+ year = {2026}
55
+ }
56
+ ```