prithivMLmods commited on
Commit
e64ac70
·
verified ·
1 Parent(s): 0d52a05

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +123 -1
README.md CHANGED
@@ -2,6 +2,128 @@
2
  library_name: transformers
3
  ---
4
 
 
5
 
 
6
 
7
- ![1](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/2ah2xHghr95yLxeW4xSkS.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  library_name: transformers
3
  ---
4
 
5
+ ![1](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/2ah2xHghr95yLxeW4xSkS.png)
6
 
7
+ # **OpenCaption-4B-VL-SFT-v1.0**
8
 
9
+ > **OpenCaption-4B-VL-SFT-v1.0** is a vision-language captioning model built on top of **Qwen/Qwen3-VL-4B-Instruct**. It was trained for **image captioning** and **high-quality dense image captioning** using a fine-grained mixture of long-form image description traces. The model is designed to produce richer visual understanding than conventional captions by capturing scene composition, object relationships, spatial reasoning, attributes, actions, lighting, background context, and fine visual details.
10
+
11
+ > [!NOTE]
12
+ > This model is an experimental release and may produce unexpected outputs in some scenarios.
13
+
14
+ ## **Key Highlights**
15
+
16
+ * **Qwen 3-VL Foundation**: Built on top of **Qwen/Qwen3-VL-4B-Instruct**.
17
+ * **Dense Visual Captioning**: Focused on detailed image understanding and long-form image description.
18
+ * **Fine-Grained Descriptions**: Captures object relationships, spatial layout, attributes, actions, lighting, and context.
19
+ * **Captioning-Oriented Training**: Optimized for detailed image caption generation rather than generic short descriptions.
20
+ * **Research-Focused Release**: Intended for experimentation, evaluation, and captioning research.
21
+ * **Efficient 4B Deployment**: Suitable for local inference and research workflows.
22
+
23
+ ## **Quick Start with Transformers**
24
+
25
+ Install the required packages:
26
+
27
+ ```bash
28
+ pip install transformers accelerate qwen-vl-utils
29
+ ```
30
+
31
+ Use the model with the following example:
32
+
33
+ ```python
34
+ from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
35
+ from qwen_vl_utils import process_vision_info
36
+ import torch
37
+
38
+ # Load the model
39
+ model = Qwen3VLForConditionalGeneration.from_pretrained(
40
+ "prithivMLmods/OpenCaption-4B-VL-SFT-v1.0",
41
+ torch_dtype="auto",
42
+ device_map="auto"
43
+ )
44
+
45
+ processor = AutoProcessor.from_pretrained(
46
+ "prithivMLmods/OpenCaption-4B-VL-SFT-v1.0"
47
+ )
48
+
49
+ messages = [
50
+ {
51
+ "role": "user",
52
+ "content": [
53
+ {
54
+ "type": "image",
55
+ "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
56
+ },
57
+ {
58
+ "type": "text",
59
+ "text": "Provide a detailed caption for this image with fine-grained visual details."
60
+ },
61
+ ],
62
+ }
63
+ ]
64
+
65
+ text = processor.apply_chat_template(
66
+ messages,
67
+ tokenize=False,
68
+ add_generation_prompt=True
69
+ )
70
+
71
+ image_inputs, video_inputs = process_vision_info(messages)
72
+
73
+ inputs = processor(
74
+ text=[text],
75
+ images=image_inputs,
76
+ videos=video_inputs,
77
+ padding=True,
78
+ return_tensors="pt",
79
+ ).to(model.device)
80
+
81
+ generated_ids = model.generate(
82
+ **inputs,
83
+ max_new_tokens=512
84
+ )
85
+
86
+ generated_ids_trimmed = [
87
+ out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
88
+ ]
89
+
90
+ output_text = processor.batch_decode(
91
+ generated_ids_trimmed,
92
+ skip_special_tokens=True,
93
+ clean_up_tokenization_spaces=False
94
+ )
95
+
96
+ print(output_text[0])
97
+ ```
98
+
99
+ ## **Training Details**
100
+
101
+ | Setting | Value |
102
+ | :--------------------- | :------------------------------------------------------------- |
103
+ | **Base Model** | **Qwen/Qwen3-VL-4B-Instruct** |
104
+ | **Training Method** | **Single-stage supervised fine-tuning (SFT)** |
105
+ | **Training Objective** | **Fine-grained image captioning and dense visual description** |
106
+ | **Training Precision** | **BF16 (Full Precision)** |
107
+ | **Training Data** | **10K Dense Image Caption Traces** |
108
+
109
+ ## **Intended Use**
110
+
111
+ * **Image Captioning**: Generating clear and detailed captions for images.
112
+ * **Dense Image Understanding**: Describing scenes with richer visual context and fine-grained detail.
113
+ * **Visual Reasoning**: Explaining object placement, interactions, and relationships in an image.
114
+ * **Research and Evaluation**: Studying caption quality, visual grounding, and multimodal fine-tuning.
115
+ * **Local Deployment**: Running a compact 4B vision-language captioning model for experimentation.
116
+
117
+ ## **Limitations**
118
+
119
+ * **Experimental Model**: Output quality may vary across domains and image styles.
120
+ * **Caption Biases**: Performance depends on the diversity and quality of the training traces.
121
+ * **Hallucinations**: Like other multimodal models, the model may occasionally describe details that are not present.
122
+ * **Not a Ground-Truth Detector**: The model is designed for captioning and visual description, not strict object verification.
123
+
124
+ ## **Acknowledgements**
125
+
126
+ * **[Qwen/Qwen3-VL-4B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct)**: Base model used for this project.
127
+ * **[Transformers](https://huggingface.co/docs/transformers/en/index)**: Core inference and model-loading library.
128
+ * **[qwen-vl-utils](https://github.com/QwenLM/Qwen2.5-VL)**: Utility helpers for vision-language input processing.
129
+ * **TRL**: Used in the training and alignment workflow for supervised fine-tuning.