Image-Text-to-Text
Safetensors
xtuner
LZHgrla commited on
Commit
b28f2d5
1 Parent(s): 693ed13

first commit

Browse files
llm_adapter/README.md ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: internlm/internlm2-chat-20b
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- 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. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ 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).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+
201
+
202
+ ## Training procedure
203
+
204
+
205
+ The following `bitsandbytes` quantization config was used during training:
206
+ - quant_method: bitsandbytes
207
+ - load_in_8bit: False
208
+ - load_in_4bit: True
209
+ - llm_int8_threshold: 6.0
210
+ - llm_int8_skip_modules: None
211
+ - llm_int8_enable_fp32_cpu_offload: False
212
+ - llm_int8_has_fp16_weight: False
213
+ - bnb_4bit_quant_type: nf4
214
+ - bnb_4bit_use_double_quant: True
215
+ - bnb_4bit_compute_dtype: float16
216
+
217
+ ### Framework versions
218
+
219
+
220
+ - PEFT 0.6.2
llm_adapter/adapter_config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "internlm/internlm2-chat-20b",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": true,
9
+ "layers_pattern": null,
10
+ "layers_to_transform": null,
11
+ "lora_alpha": 256,
12
+ "lora_dropout": 0.05,
13
+ "modules_to_save": null,
14
+ "peft_type": "LORA",
15
+ "r": 512,
16
+ "rank_pattern": {},
17
+ "revision": null,
18
+ "target_modules": [
19
+ "w2",
20
+ "w3",
21
+ "wo",
22
+ "output",
23
+ "wqkv",
24
+ "w1"
25
+ ],
26
+ "task_type": "CAUSAL_LM"
27
+ }
llm_adapter/adapter_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9fc72de74db247df6eb7526ac56f8bda015bd57a6272b2b543f7c2d27355e75f
3
+ size 4731743618
projector/config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ProjectorModel"
4
+ ],
5
+ "auto_map": {
6
+ "AutoConfig": "configuration_projector.ProjectorConfig",
7
+ "AutoModel": "modeling_projector.ProjectorModel"
8
+ },
9
+ "bias": true,
10
+ "depth": 2,
11
+ "hidden_act": "gelu",
12
+ "llm_hidden_size": 6144,
13
+ "model_type": "projector",
14
+ "torch_dtype": "float32",
15
+ "transformers_version": "4.36.2",
16
+ "visual_hidden_size": 1024
17
+ }
projector/configuration_projector.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) OpenMMLab. All rights reserved.
2
+ from transformers import PretrainedConfig
3
+
4
+
5
+ class ProjectorConfig(PretrainedConfig):
6
+ model_type = 'projector'
7
+ _auto_class = 'AutoConfig'
8
+
9
+ def __init__(
10
+ self,
11
+ visual_hidden_size=4096,
12
+ llm_hidden_size=4096,
13
+ depth=2,
14
+ hidden_act='gelu',
15
+ bias=True,
16
+ **kwargs,
17
+ ):
18
+ self.visual_hidden_size = visual_hidden_size
19
+ self.llm_hidden_size = llm_hidden_size
20
+ self.depth = depth
21
+ self.hidden_act = hidden_act
22
+ self.bias = bias
23
+ super().__init__(**kwargs)
projector/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cd58fa0320ab8588f749a216e4518a722bed6b3e0371b3bbe6a67a88313a3490
3
+ size 176210288
projector/modeling_projector.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) OpenMMLab. All rights reserved.
2
+ import torch
3
+ import torch.nn as nn
4
+ from transformers import PreTrainedModel
5
+ from transformers.activations import ACT2FN
6
+
7
+ from .configuration_projector import ProjectorConfig
8
+
9
+
10
+ class ProjectorModel(PreTrainedModel):
11
+ _auto_class = 'AutoModel'
12
+ config_class = ProjectorConfig
13
+ base_model_prefix = 'model'
14
+ supports_gradient_checkpointing = True
15
+
16
+ def __init__(self, config: ProjectorConfig) -> None:
17
+ super().__init__(config)
18
+ self.gradient_checkpointing = False
19
+
20
+ modules = [
21
+ nn.Linear(
22
+ config.visual_hidden_size,
23
+ config.llm_hidden_size,
24
+ bias=config.bias)
25
+ ]
26
+ for _ in range(1, config.depth):
27
+ modules.append(ACT2FN[config.hidden_act])
28
+ modules.append(
29
+ nn.Linear(
30
+ config.llm_hidden_size,
31
+ config.llm_hidden_size,
32
+ bias=config.bias))
33
+ self.model = nn.Sequential(*modules)
34
+
35
+ def enable_input_require_grads(self):
36
+
37
+ def make_inputs_require_grad(module, input, output):
38
+ output.requires_grad_(True)
39
+
40
+ self.model.register_forward_hook(make_inputs_require_grad)
41
+
42
+ def _set_gradient_checkpointing(self, module, value=False):
43
+ if isinstance(module, ProjectorModel):
44
+ module.gradient_checkpointing = value
45
+
46
+ def forward(self, x):
47
+ if self.gradient_checkpointing and self.training:
48
+ layer_outputs = torch.utils.checkpoint.checkpoint(self.model, x)
49
+ else:
50
+ layer_outputs = self.model(x)
51
+ return layer_outputs
visual_encoder_adapter/README.md ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: openai/clip-vit-large-patch14-336
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- 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. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ 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).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+
201
+
202
+ ## Training procedure
203
+
204
+
205
+ ### Framework versions
206
+
207
+
208
+ - PEFT 0.6.2
visual_encoder_adapter/adapter_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": {
4
+ "base_model_class": "CLIPVisionModel",
5
+ "parent_library": "transformers.models.clip.modeling_clip"
6
+ },
7
+ "base_model_name_or_path": "openai/clip-vit-large-patch14-336",
8
+ "bias": "none",
9
+ "fan_in_fan_out": false,
10
+ "inference_mode": true,
11
+ "init_lora_weights": true,
12
+ "layers_pattern": null,
13
+ "layers_to_transform": null,
14
+ "lora_alpha": 16,
15
+ "lora_dropout": 0.05,
16
+ "modules_to_save": null,
17
+ "peft_type": "LORA",
18
+ "r": 64,
19
+ "rank_pattern": {},
20
+ "revision": null,
21
+ "target_modules": [
22
+ "k_proj",
23
+ "fc1",
24
+ "out_proj",
25
+ "fc2",
26
+ "v_proj",
27
+ "q_proj"
28
+ ],
29
+ "task_type": null
30
+ }
visual_encoder_adapter/adapter_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:570a90a862bc794599af6c6d3e908526fee357fda67ff8c20d83e3133a50854d
3
+ size 113350282
xtuner_config.py ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SYSTEM = ''
2
+ accumulative_counts = 2
3
+ batch_size = 8
4
+ betas = (
5
+ 0.9,
6
+ 0.999,
7
+ )
8
+ custom_hooks = [
9
+ dict(
10
+ tokenizer=dict(
11
+ padding_side='right',
12
+ pretrained_model_name_or_path='internlm/internlm2-chat-20b',
13
+ trust_remote_code=True,
14
+ type='transformers.AutoTokenizer.from_pretrained'),
15
+ type='xtuner.engine.DatasetInfoHook'),
16
+ dict(
17
+ evaluation_images='https://llava-vl.github.io/static/images/view.jpg',
18
+ evaluation_inputs=[
19
+ '请描述一下这张照片',
20
+ 'Please describe this picture',
21
+ ],
22
+ every_n_iters=500,
23
+ image_processor=dict(
24
+ pretrained_model_name_or_path='openai/clip-vit-large-patch14-336',
25
+ trust_remote_code=True,
26
+ type='transformers.CLIPImageProcessor.from_pretrained'),
27
+ prompt_template='xtuner.utils.PROMPT_TEMPLATE.internlm2_chat',
28
+ system='',
29
+ tokenizer=dict(
30
+ padding_side='right',
31
+ pretrained_model_name_or_path='internlm/internlm2-chat-20b',
32
+ trust_remote_code=True,
33
+ type='transformers.AutoTokenizer.from_pretrained'),
34
+ type='xtuner.engine.EvaluateChatHook'),
35
+ ]
36
+ data_path = './data/llava_data/LLaVA-Instruct-150K/llava_v1_5_mix665k.json'
37
+ data_root = './data/llava_data/'
38
+ dataloader_num_workers = 0
39
+ default_hooks = dict(
40
+ checkpoint=dict(interval=1, type='mmengine.hooks.CheckpointHook'),
41
+ logger=dict(interval=10, type='mmengine.hooks.LoggerHook'),
42
+ param_scheduler=dict(type='mmengine.hooks.ParamSchedulerHook'),
43
+ sampler_seed=dict(type='mmengine.hooks.DistSamplerSeedHook'),
44
+ timer=dict(type='mmengine.hooks.IterTimerHook'))
45
+ env_cfg = dict(
46
+ cudnn_benchmark=False,
47
+ dist_cfg=dict(backend='nccl'),
48
+ mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0))
49
+ evaluation_freq = 500
50
+ evaluation_images = 'https://llava-vl.github.io/static/images/view.jpg'
51
+ evaluation_inputs = [
52
+ '请描述一下这张照片',
53
+ 'Please describe this picture',
54
+ ]
55
+ image_folder = './data/llava_data/llava_images'
56
+ image_processor = dict(
57
+ pretrained_model_name_or_path='openai/clip-vit-large-patch14-336',
58
+ trust_remote_code=True,
59
+ type='transformers.CLIPImageProcessor.from_pretrained')
60
+ launcher = 'pytorch'
61
+ llava_dataset = dict(
62
+ data_path='./data/llava_data/LLaVA-Instruct-150K/llava_v1_5_mix665k.json',
63
+ dataset_map_fn='xtuner.dataset.map_fns.llava_map_fn',
64
+ image_folder='./data/llava_data/llava_images',
65
+ image_processor=dict(
66
+ pretrained_model_name_or_path='openai/clip-vit-large-patch14-336',
67
+ trust_remote_code=True,
68
+ type='transformers.CLIPImageProcessor.from_pretrained'),
69
+ max_length=1472,
70
+ pad_image_to_square=True,
71
+ template_map_fn=dict(
72
+ template='xtuner.utils.PROMPT_TEMPLATE.internlm2_chat',
73
+ type='xtuner.dataset.map_fns.template_map_fn_factory'),
74
+ tokenizer=dict(
75
+ padding_side='right',
76
+ pretrained_model_name_or_path='internlm/internlm2-chat-20b',
77
+ trust_remote_code=True,
78
+ type='transformers.AutoTokenizer.from_pretrained'),
79
+ type='xtuner.dataset.LLaVADataset')
80
+ llm_name_or_path = 'internlm/internlm2-chat-20b'
81
+ load_from = None
82
+ log_level = 'INFO'
83
+ lr = 0.0002
84
+ max_epochs = 1
85
+ max_length = 1472
86
+ max_norm = 1
87
+ model = dict(
88
+ freeze_llm=True,
89
+ freeze_visual_encoder=True,
90
+ llm=dict(
91
+ pretrained_model_name_or_path='internlm/internlm2-chat-20b',
92
+ quantization_config=dict(
93
+ bnb_4bit_compute_dtype='torch.float16',
94
+ bnb_4bit_quant_type='nf4',
95
+ bnb_4bit_use_double_quant=True,
96
+ llm_int8_has_fp16_weight=False,
97
+ llm_int8_threshold=6.0,
98
+ load_in_4bit=True,
99
+ load_in_8bit=False,
100
+ type='transformers.BitsAndBytesConfig'),
101
+ torch_dtype='torch.float16',
102
+ trust_remote_code=True,
103
+ type='transformers.AutoModelForCausalLM.from_pretrained'),
104
+ llm_lora=dict(
105
+ bias='none',
106
+ lora_alpha=256,
107
+ lora_dropout=0.05,
108
+ r=512,
109
+ task_type='CAUSAL_LM',
110
+ type='peft.LoraConfig'),
111
+ pretrained_pth=
112
+ './work_dirs/llava_internlm2_chat_20b_clip_vit_large_p14_336_e1_gpu8_pretrain/epoch_1.pth',
113
+ type='xtuner.model.LLaVAModel',
114
+ visual_encoder=dict(
115
+ pretrained_model_name_or_path='openai/clip-vit-large-patch14-336',
116
+ type='transformers.CLIPVisionModel.from_pretrained'),
117
+ visual_encoder_lora=dict(
118
+ bias='none',
119
+ lora_alpha=16,
120
+ lora_dropout=0.05,
121
+ r=64,
122
+ type='peft.LoraConfig'))
123
+ optim_type = 'torch.optim.AdamW'
124
+ optim_wrapper = dict(
125
+ optimizer=dict(
126
+ betas=(
127
+ 0.9,
128
+ 0.999,
129
+ ),
130
+ lr=0.0002,
131
+ type='torch.optim.AdamW',
132
+ weight_decay=0),
133
+ type='DeepSpeedOptimWrapper')
134
+ param_scheduler = [
135
+ dict(
136
+ begin=0,
137
+ by_epoch=True,
138
+ convert_to_iter_based=True,
139
+ end=0.03,
140
+ start_factor=1e-05,
141
+ type='mmengine.optim.LinearLR'),
142
+ dict(
143
+ T_max=1,
144
+ begin=0.03,
145
+ by_epoch=True,
146
+ convert_to_iter_based=True,
147
+ eta_min=0.0,
148
+ type='mmengine.optim.CosineAnnealingLR'),
149
+ ]
150
+ pretrained_pth = './work_dirs/llava_internlm2_chat_20b_clip_vit_large_p14_336_e1_gpu8_pretrain/epoch_1.pth'
151
+ prompt_template = 'xtuner.utils.PROMPT_TEMPLATE.internlm2_chat'
152
+ randomness = dict(deterministic=False, seed=None)
153
+ resume = False
154
+ runner_type = 'FlexibleRunner'
155
+ strategy = dict(
156
+ config=dict(
157
+ bf16=dict(enabled=True),
158
+ fp16=dict(enabled=False, initial_scale_power=16),
159
+ gradient_accumulation_steps='auto',
160
+ gradient_clipping='auto',
161
+ train_micro_batch_size_per_gpu='auto',
162
+ zero_allow_untested_optimizer=True,
163
+ zero_force_ds_cpu_optimizer=False,
164
+ zero_optimization=dict(overlap_comm=True, stage=2)),
165
+ exclude_frozen_parameters=True,
166
+ gradient_accumulation_steps=2,
167
+ gradient_clipping=1,
168
+ train_micro_batch_size_per_gpu=8,
169
+ type='xtuner.engine.DeepSpeedStrategy')
170
+ tokenizer = dict(
171
+ padding_side='right',
172
+ pretrained_model_name_or_path='internlm/internlm2-chat-20b',
173
+ trust_remote_code=True,
174
+ type='transformers.AutoTokenizer.from_pretrained')
175
+ train_cfg = dict(by_epoch=True, max_epochs=1, val_interval=1)
176
+ train_dataloader = dict(
177
+ batch_size=8,
178
+ collate_fn=dict(type='xtuner.dataset.collate_fns.default_collate_fn'),
179
+ dataset=dict(
180
+ data_path=
181
+ './data/llava_data/LLaVA-Instruct-150K/llava_v1_5_mix665k.json',
182
+ dataset_map_fn='xtuner.dataset.map_fns.llava_map_fn',
183
+ image_folder='./data/llava_data/llava_images',
184
+ image_processor=dict(
185
+ pretrained_model_name_or_path='openai/clip-vit-large-patch14-336',
186
+ trust_remote_code=True,
187
+ type='transformers.CLIPImageProcessor.from_pretrained'),
188
+ max_length=1472,
189
+ pad_image_to_square=True,
190
+ template_map_fn=dict(
191
+ template='xtuner.utils.PROMPT_TEMPLATE.internlm2_chat',
192
+ type='xtuner.dataset.map_fns.template_map_fn_factory'),
193
+ tokenizer=dict(
194
+ padding_side='right',
195
+ pretrained_model_name_or_path='internlm/internlm2-chat-20b',
196
+ trust_remote_code=True,
197
+ type='transformers.AutoTokenizer.from_pretrained'),
198
+ type='xtuner.dataset.LLaVADataset'),
199
+ num_workers=0,
200
+ sampler=dict(
201
+ length_property='modality_length',
202
+ per_device_batch_size=16,
203
+ type='xtuner.dataset.samplers.LengthGroupedSampler'))
204
+ visual_encoder_name_or_path = 'openai/clip-vit-large-patch14-336'
205
+ visualizer = None
206
+ warmup_ratio = 0.03
207
+ weight_decay = 0
208
+ work_dir = './work_dirs/llava_internlm2_chat_20b_qlora_clip_vit_large_p14_336_lora_e1_gpu8_finetune'