rp-yu commited on
Commit
d10f1de
ยท
verified ยท
1 Parent(s): 8379959

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +112 -177
README.md CHANGED
@@ -17,197 +17,132 @@ base_model:
17
  pipeline_tag: image-text-to-text
18
  ---
19
 
20
- # Model Card for Model ID
21
 
22
- <!-- Provide a quick summary of what the model is/does. -->
23
 
 
 
24
 
 
25
 
26
- ## Model Details
27
-
28
- ### Model Description
29
-
30
- <!-- Provide a longer summary of what this model is. -->
31
-
32
- This is the model card of a ๐Ÿค— transformers model that has been pushed on the Hub. This model card has been automatically generated.
33
-
34
- - **Developed by:** [More Information Needed]
35
- - **Funded by [optional]:** [More Information Needed]
36
- - **Shared by [optional]:** [More Information Needed]
37
- - **Model type:** [More Information Needed]
38
- - **Language(s) (NLP):** [More Information Needed]
39
- - **License:** [More Information Needed]
40
- - **Finetuned from model [optional]:** [More Information Needed]
41
-
42
- ### Model Sources [optional]
43
-
44
- <!-- Provide the basic links for the model. -->
45
-
46
- - **Repository:** [More Information Needed]
47
- - **Paper [optional]:** [More Information Needed]
48
- - **Demo [optional]:** [More Information Needed]
49
-
50
- ## Uses
51
-
52
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
53
-
54
- ### Direct Use
55
-
56
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
57
-
58
- [More Information Needed]
59
-
60
- ### Downstream Use [optional]
61
-
62
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
63
-
64
- [More Information Needed]
65
-
66
- ### Out-of-Scope Use
67
-
68
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
69
-
70
- [More Information Needed]
71
-
72
- ## Bias, Risks, and Limitations
73
-
74
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
75
-
76
- [More Information Needed]
77
-
78
- ### Recommendations
79
-
80
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
81
-
82
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
83
-
84
- ## How to Get Started with the Model
85
-
86
- Use the code below to get started with the model.
87
-
88
- [More Information Needed]
89
-
90
- ## Training Details
91
-
92
- ### Training Data
93
-
94
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
95
-
96
- [More Information Needed]
97
-
98
- ### Training Procedure
99
-
100
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
101
-
102
- #### Preprocessing [optional]
103
-
104
- [More Information Needed]
105
-
106
-
107
- #### Training Hyperparameters
108
-
109
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
110
-
111
- #### Speeds, Sizes, Times [optional]
112
-
113
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
114
-
115
- [More Information Needed]
116
-
117
- ## Evaluation
118
-
119
- <!-- This section describes the evaluation protocols and provides the results. -->
120
-
121
- ### Testing Data, Factors & Metrics
122
-
123
- #### Testing Data
124
-
125
- <!-- This should link to a Dataset Card if possible. -->
126
-
127
- [More Information Needed]
128
-
129
- #### Factors
130
-
131
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
132
-
133
- [More Information Needed]
134
-
135
- #### Metrics
136
-
137
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
138
-
139
- [More Information Needed]
140
-
141
- ### Results
142
-
143
- [More Information Needed]
144
-
145
- #### Summary
146
-
147
-
148
-
149
- ## Model Examination [optional]
150
-
151
- <!-- Relevant interpretability work for the model goes here -->
152
-
153
- [More Information Needed]
154
-
155
- ## Environmental Impact
156
-
157
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
158
-
159
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
160
-
161
- - **Hardware Type:** [More Information Needed]
162
- - **Hours used:** [More Information Needed]
163
- - **Cloud Provider:** [More Information Needed]
164
- - **Compute Region:** [More Information Needed]
165
- - **Carbon Emitted:** [More Information Needed]
166
-
167
- ## Technical Specifications [optional]
168
-
169
- ### Model Architecture and Objective
170
-
171
- [More Information Needed]
172
-
173
- ### Compute Infrastructure
174
-
175
- [More Information Needed]
176
-
177
- #### Hardware
178
-
179
- [More Information Needed]
180
-
181
- #### Software
182
-
183
- [More Information Needed]
184
-
185
- ## Citation [optional]
186
-
187
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
188
 
189
- **BibTeX:**
190
 
191
- [More Information Needed]
 
 
 
192
 
193
- **APA:**
194
 
195
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
 
197
- ## Glossary [optional]
198
 
199
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
200
 
201
- [More Information Needed]
202
 
203
- ## More Information [optional]
 
 
 
 
204
 
205
- [More Information Needed]
206
 
207
- ## Model Card Authors [optional]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
 
209
- [More Information Needed]
210
 
211
- ## Model Card Contact
212
 
213
- [More Information Needed]
 
 
17
  pipeline_tag: image-text-to-text
18
  ---
19
 
20
+ # Dimple-7B ๐ŸงŠ
21
 
22
+ **Dimple** is the first Discrete Diffusion Multimodal Large Language Model (DMLLM) that leverages a hybrid training paradigm combining autoregressive and diffusion-based instruction tuning. The model architecture is similar to Qwen and LLaVA, while introducing a novel **autoregressive-then-diffusion** training strategy:
23
 
24
+ * **Stage 1**: Autoregressive fine-tuning for alignment and initial instruction tuning.
25
+ * **Stage 2**: Diffusion-based fine-tuning for enhanced instruction-following capabilities.
26
 
27
+ Trained on the same dataset as LLaVA-NEXT, **Dimple-7B surpasses LLaVA-NEXT-7B by 3.9%**, demonstrating that diffusion-based multimodal language models can match its autoregressive counterparts under similar training budget.
28
 
29
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
+ ## ๐Ÿ” Highlights
32
 
33
+ * **Hybrid Training**: Combines autoregressive and diffusion training.
34
+ * **Diffusion Decoding**: Supports confident decoding, maskgit-style decoding, and entropy-based decoding.
35
+ * **Controllable Generation**: Enables fine-grained control over format, structure, and length via structure priors.
36
+ * **Autoregressive-like Prefilling**: Enhances inference speed using prefilling techniques.
37
 
38
+ ---
39
 
40
+ ## ๐Ÿ“Š Evaluation Results
41
+
42
+ | Benchmark | Dimple-7B (ours) | LLaVA-1.5-7B | LLaVA-NEXT-7B | Eagle-7B | Eagle2-9B | Qwen-VL-7B | Qwen2.5-VL-7B |
43
+ | --------------------- | ---------------- | ------------ | ------------- | -------- | --------- | ---------- | ------------- |
44
+ | **Training Samples** | 1.3M | 1.2M | 1.3M | 2.4M | 27.8M | 1.5B | - |
45
+ | **Training Tokens** | 0.8B | - | - | - | - | - | 2.6T |
46
+ | **Base LLM** | Dream (Qwen2.5) | Vicuna | Vicuna-1.5 | Vicuna | Qwen2.5 | Qwen | Qwen2.5 |
47
+ | **GQA** | 59.2 | 62.0 | 64.8 | 64.9 | - | 59.3 | - |
48
+ | **MMBench (en test)** | 74.6 | 64.3 | 68.7 | 68.4 | - | - | 83.5 |
49
+ | **MME (Perception)** | 1514 | 1510 | 1519 | 1528 | - | - | - |
50
+ | **MME (Cognition)** | 432 | - | 332 | - | - | - | - |
51
+ | **MME (Total)** | 1946 | - | 1851 | - | - | - | 2347 |
52
+ | **POPE** | 86.2 | 85.8 | 86.7 | 88.8 | - | - | - |
53
+ | **MMMU (val)** | 45.2 | - | 35.8 | 36.3 | 56.1 | - | 58.6 |
54
+ | **SQA (img)** | 77.1 | 66.8 | 72.8 | 70.0 | - | - | - |
55
+ | **AI2D** | 74.4 | - | 65.4 | - | 83.9 | 62.3 | 83.9 |
56
+ | **ChartQA** | 63.4 | - | 54.9 | 67.7 | 86.4 | 65.7 | 87.3 |
57
+ | **TextVQA** | 61.6 | - | 64.8 | - | 83.0 | - | - |
58
+ | **OCRBench** | 565 | - | 490 | 529 | - | - | - |
59
+ | **MathVista (mini)** | 42.3 | - | 33.0 | - | 63.8 | 37.0 | 68.2 |
60
+ | **MMVet** | 41.2 | 31.1 | 47.3 | - | 62.2 | - | 67.1 |
61
 
62
+ ---
63
 
64
+ ## ๐Ÿ› ๏ธ Environment
65
 
66
+ Make sure your environment includes the following versions:
67
 
68
+ ```bash
69
+ transformers==4.46.2
70
+ torch==2.5.1
71
+ accelerate==1.6.0
72
+ ```
73
 
74
+ ---
75
 
76
+ ## ๐Ÿš€ Inference Example
77
+
78
+ ```python
79
+ import torch
80
+ from transformers import AutoProcessor, AutoModel
81
+ import json, requests
82
+ from PIL import Image
83
+
84
+ model_name = "rp-yu/Dimple-7B"
85
+ processor = AutoProcessor.from_pretrained(
86
+ model_name,
87
+ trust_remote_code=True
88
+ )
89
+ model = AutoModel.from_pretrained(
90
+ model_name,
91
+ torch_dtype=torch.bfloat16,
92
+ trust_remote_code=True,
93
+ )
94
+
95
+ image_url = "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"
96
+ messages = [
97
+ [{"role": "user", "content": [
98
+ {"type": "image", "image": image_url},
99
+ {"type": "text", "text": "Describe this image."}
100
+ ]}],
101
+ ]
102
+ text = processor.apply_chat_template(
103
+ messages, tokenize=False, add_generation_prompt=True, add_vision_id=False
104
+ )
105
+ images = [
106
+ Image.open(requests.get(image_url, stream=True).raw).convert("RGB").resize((336, 336), Image.LANCZOS)
107
+ ]
108
+
109
+ inputs = processor(
110
+ text=text,
111
+ images=images,
112
+ videos=None,
113
+ padding="longest",
114
+ return_tensors="pt",
115
+ )
116
+
117
+ input_ids = inputs.pop("input_ids")
118
+ output = model.diffusion_generate(
119
+ input_ids,
120
+ max_new_tokens=64,
121
+ output_history=True,
122
+ return_dict_in_generate=True,
123
+ steps=64,
124
+ temperature=0.2,
125
+ top_p=0.95,
126
+ alg="maskgit_plus",
127
+ use_cache=True,
128
+ alg_p_threshold=0.95,
129
+ use_original_confidence=True,
130
+ decoding_pipeline="dim",
131
+ **inputs
132
+ )
133
+
134
+ generations = [
135
+ processor.tokenizer.decode(g[len(p):].cpu().tolist())
136
+ for p, g in zip(input_ids, output.sequences)
137
+ ]
138
+
139
+ for j in range(len(messages)):
140
+ print("output:", j, generations[j].split(processor.tokenizer.eos_token)[0])
141
+ ```
142
 
143
+ ---
144
 
145
+ ## ๐Ÿ“š Citation
146
 
147
+ > Citation information will be provided soon.
148
+ > Please stay tuned if you are interested in citing **Dimple** in your work.