kkk5 commited on
Commit
3032412
·
verified ·
1 Parent(s): 74bbeb7

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: llama2
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama2
3
+ base_model:
4
+ - llava-hf/llava-1.5-7b-hf
5
+ pipeline_tag: image-text-to-text
6
+ tags:
7
+ - image-captioning
8
+ - reinforcement-learning
9
+ - GRPO
10
+ ---
11
+
12
+ # CIM-LLaVA1.5-7B
13
+
14
+ This model is fine-tuned from [LLaVA-1.5-7B](https://huggingface.co/llava-hf/llava-1.5-7b-hf) using **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 LlavaForConditionalGeneration, AutoProcessor
27
+ from PIL import Image
28
+
29
+ model = LlavaForConditionalGeneration.from_pretrained("kkk5/CIM-LLaVA1.5-7B", torch_dtype="auto", device_map="auto")
30
+ processor = AutoProcessor.from_pretrained("kkk5/CIM-LLaVA1.5-7B")
31
+
32
+ image = Image.open("your_image.jpg").convert("RGB")
33
+ messages = [{"role": "user", "content": [
34
+ {"type": "image"},
35
+ {"type": "text", "text": "Caption this image as accurately as possible, without speculation. Describe what you see."},
36
+ ]}]
37
+
38
+ text = processor.apply_chat_template(messages, add_generation_prompt=True)
39
+ inputs = processor(images=image, text=text, 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
+ ```