first commit
Browse files- README.md +79 -1
- llm_adapter/README.md +220 -0
- llm_adapter/adapter_config.json +28 -0
- llm_adapter/adapter_model.bin +3 -0
- projector/config.json +17 -0
- projector/configuration_projector.py +23 -0
- projector/modeling_projector.py +51 -0
- projector/pytorch_model.bin +3 -0
- visual_encoder_adapter/README.md +208 -0
- visual_encoder_adapter/adapter_config.json +30 -0
- visual_encoder_adapter/adapter_model.bin +3 -0
- xtuner_config.py +208 -0
README.md
CHANGED
@@ -1,3 +1,81 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
library_name: peft
|
3 |
+
datasets:
|
4 |
+
- liuhaotian/LLaVA-Pretrain
|
5 |
+
- liuhaotian/LLaVA-Instruct-150K
|
6 |
+
pipeline_tag: visual-question-answering
|
7 |
---
|
8 |
+
|
9 |
+
<div align="center">
|
10 |
+
<img src="https://github.com/InternLM/lmdeploy/assets/36994684/0cf8d00f-e86b-40ba-9b54-dc8f1bc6c8d8" width="600"/>
|
11 |
+
|
12 |
+
|
13 |
+
[![Generic badge](https://img.shields.io/badge/GitHub-%20XTuner-black.svg)](https://github.com/InternLM/xtuner)
|
14 |
+
|
15 |
+
|
16 |
+
</div>
|
17 |
+
|
18 |
+
## Model
|
19 |
+
|
20 |
+
llava-internlm-chat-7b-clip-vit-large-p14-336 is a LLaVA model fine-tuned from [InternLM-Chat-7B](https://huggingface.co/internlm/internlm-chat-7b) and [CLIP-ViT-Large-patch14-336](https://huggingface.co/openai/clip-vit-large-patch14-336) with [LLaVA-Pretrain](https://huggingface.co/datasets/liuhaotian/LLaVA-Pretrain) and [LLaVA-Instruct](https://huggingface.co/datasets/liuhaotian/LLaVA-Instruct-150K) by [XTuner](https://github.com/InternLM/xtuner).
|
21 |
+
|
22 |
+
|
23 |
+
## Quickstart
|
24 |
+
|
25 |
+
### Installation
|
26 |
+
|
27 |
+
```shell
|
28 |
+
pip install -U 'xtuner[deepspeed]'
|
29 |
+
```
|
30 |
+
|
31 |
+
### Chat
|
32 |
+
|
33 |
+
```shell
|
34 |
+
xtuner chat internlm/internlm-chat-7b \
|
35 |
+
--visual-encoder openai/clip-vit-large-patch14 \
|
36 |
+
--llava xtuner/llava-internlm-chat-7b-clip-vit-large-p14-336 \
|
37 |
+
--prompt-template internlm_chat \
|
38 |
+
--image $IMAGE_PATH
|
39 |
+
```
|
40 |
+
|
41 |
+
### Training
|
42 |
+
|
43 |
+
1. Alignment module pretraining (saved by default in `./work_dirs/`)
|
44 |
+
|
45 |
+
```shell
|
46 |
+
NPROC_PER_NODE=8 xtuner train llava_internlm_chat_7b_clip_vit_large_p14_336_e1_gpu8_pretrain --deepspeed deepspeed_zero2
|
47 |
+
```
|
48 |
+
|
49 |
+
2. Instruction following fine-tuning (saved by default in `./work_dirs/`)
|
50 |
+
|
51 |
+
```shell
|
52 |
+
NPROC_PER_NODE=8 xtuner train llava_internlm_chat_7b_qlora_clip_vit_large_p14_336_lora_e1_gpu8_finetune --deepspeed deepspeed_zero2
|
53 |
+
```
|
54 |
+
|
55 |
+
|
56 |
+
### MMBench Evaluation
|
57 |
+
|
58 |
+
XTuner integrates the MMBench evaluation, and you can perform evaluations with the following command!
|
59 |
+
|
60 |
+
```bash
|
61 |
+
xtuner mmbench internlm/internlm-chat-7b \
|
62 |
+
--visual-encoder openai/clip-vit-large-patch14 \
|
63 |
+
--llava xtuner/llava-internlm-chat-7b-clip-vit-large-p14-336 \
|
64 |
+
--prompt-template internlm_chat \
|
65 |
+
--data-path $MMBENCH_DATA_PATH \
|
66 |
+
--language en \
|
67 |
+
--work-dir $RESULT_PATH
|
68 |
+
```
|
69 |
+
|
70 |
+
After the evaluation is completed, if it's a development set, it will directly print out the results; If it's a test set, you need to submit `mmbench_result.xlsx` to the official MMBench for final evaluation to obtain precision results!
|
71 |
+
|
72 |
+
## Citation
|
73 |
+
|
74 |
+
```bibtex
|
75 |
+
@misc{2023xtuner,
|
76 |
+
title={XTuner: A Toolkit for Efficiently Fine-tuning LLM},
|
77 |
+
author={XTuner Contributors},
|
78 |
+
howpublished = {\url{https://github.com/InternLM/xtuner}},
|
79 |
+
year={2023}
|
80 |
+
}
|
81 |
+
```
|
llm_adapter/README.md
ADDED
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: peft
|
3 |
+
base_model: internlm/internlm-chat-7b
|
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,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"alpha_pattern": {},
|
3 |
+
"auto_mapping": null,
|
4 |
+
"base_model_name_or_path": "internlm/internlm-chat-7b",
|
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 |
+
"k_proj",
|
20 |
+
"q_proj",
|
21 |
+
"up_proj",
|
22 |
+
"gate_proj",
|
23 |
+
"o_proj",
|
24 |
+
"v_proj",
|
25 |
+
"down_proj"
|
26 |
+
],
|
27 |
+
"task_type": "CAUSAL_LM"
|
28 |
+
}
|
llm_adapter/adapter_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:645b4442d4f28a0f5284123f17f0431fecc13e9f4a9e0cb816788a20dc9ded46
|
3 |
+
size 2558688074
|
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": 4096,
|
13 |
+
"model_type": "projector",
|
14 |
+
"torch_dtype": "float32",
|
15 |
+
"transformers_version": "4.33.3",
|
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/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
|
projector/pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0b5b3b908d146f281b8643df2bebe7157533293689ac3e0efbbaf49f25e19aea
|
3 |
+
size 83920896
|
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 |
+
"out_proj",
|
23 |
+
"k_proj",
|
24 |
+
"q_proj",
|
25 |
+
"fc1",
|
26 |
+
"v_proj",
|
27 |
+
"fc2"
|
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:26ddd4a5f8203ee6c6df1ed0778044f5c85d7612b5c1869673b3bba4861c8f1c
|
3 |
+
size 113350282
|
xtuner_config.py
ADDED
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
SYSTEM = ''
|
2 |
+
accumulative_counts = 1
|
3 |
+
batch_size = 16
|
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/internlm-chat-7b',
|
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 |
+
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.internlm_chat',
|
28 |
+
system='',
|
29 |
+
tokenizer=dict(
|
30 |
+
padding_side='right',
|
31 |
+
pretrained_model_name_or_path='internlm/internlm-chat-7b',
|
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 |
+
dataloader_num_workers = 0
|
38 |
+
default_hooks = dict(
|
39 |
+
checkpoint=dict(interval=1, type='mmengine.hooks.CheckpointHook'),
|
40 |
+
logger=dict(interval=10, type='mmengine.hooks.LoggerHook'),
|
41 |
+
param_scheduler=dict(type='mmengine.hooks.ParamSchedulerHook'),
|
42 |
+
sampler_seed=dict(type='mmengine.hooks.DistSamplerSeedHook'),
|
43 |
+
timer=dict(type='mmengine.hooks.IterTimerHook'))
|
44 |
+
env_cfg = dict(
|
45 |
+
cudnn_benchmark=False,
|
46 |
+
dist_cfg=dict(backend='nccl'),
|
47 |
+
mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0))
|
48 |
+
evaluation_freq = 500
|
49 |
+
evaluation_images = 'https://llava-vl.github.io/static/images/view.jpg'
|
50 |
+
evaluation_inputs = [
|
51 |
+
'请描述一下这张照片',
|
52 |
+
'Please describe this picture',
|
53 |
+
]
|
54 |
+
image_folder = './data/llava_data/llava_images'
|
55 |
+
launcher = 'pytorch'
|
56 |
+
llava_data_root = './data/llava_data/'
|
57 |
+
llava_dataset = dict(
|
58 |
+
data_path='./data/llava_data/LLaVA-Instruct-150K/llava_v1_5_mix665k.json',
|
59 |
+
dataset_map_fn='xtuner.dataset.map_fns.llava_map_fn',
|
60 |
+
image_folder='./data/llava_data/llava_images',
|
61 |
+
max_length=1472,
|
62 |
+
pad_image_to_square=True,
|
63 |
+
processor=dict(
|
64 |
+
pretrained_model_name_or_path='openai/clip-vit-large-patch14-336',
|
65 |
+
trust_remote_code=True,
|
66 |
+
type='transformers.CLIPImageProcessor.from_pretrained'),
|
67 |
+
template_map_fn=dict(
|
68 |
+
template='xtuner.utils.PROMPT_TEMPLATE.internlm_chat',
|
69 |
+
type='xtuner.dataset.map_fns.template_map_fn_factory'),
|
70 |
+
tokenizer=dict(
|
71 |
+
padding_side='right',
|
72 |
+
pretrained_model_name_or_path='internlm/internlm-chat-7b',
|
73 |
+
trust_remote_code=True,
|
74 |
+
type='transformers.AutoTokenizer.from_pretrained'),
|
75 |
+
type='xtuner.dataset.LLaVADataset')
|
76 |
+
llm_name_or_path = 'internlm/internlm-chat-7b'
|
77 |
+
load_from = None
|
78 |
+
log_level = 'INFO'
|
79 |
+
lr = 0.0002
|
80 |
+
max_epochs = 1
|
81 |
+
max_length = 1472
|
82 |
+
max_norm = 1
|
83 |
+
model = dict(
|
84 |
+
freeze_llm=True,
|
85 |
+
freeze_visual_encoder=True,
|
86 |
+
llm=dict(
|
87 |
+
pretrained_model_name_or_path='internlm/internlm-chat-7b',
|
88 |
+
quantization_config=dict(
|
89 |
+
bnb_4bit_compute_dtype='torch.float16',
|
90 |
+
bnb_4bit_quant_type='nf4',
|
91 |
+
bnb_4bit_use_double_quant=True,
|
92 |
+
llm_int8_has_fp16_weight=False,
|
93 |
+
llm_int8_threshold=6.0,
|
94 |
+
load_in_4bit=True,
|
95 |
+
load_in_8bit=False,
|
96 |
+
type='transformers.BitsAndBytesConfig'),
|
97 |
+
torch_dtype='torch.float16',
|
98 |
+
trust_remote_code=True,
|
99 |
+
type='transformers.AutoModelForCausalLM.from_pretrained'),
|
100 |
+
llm_lora=dict(
|
101 |
+
bias='none',
|
102 |
+
lora_alpha=256,
|
103 |
+
lora_dropout=0.05,
|
104 |
+
r=512,
|
105 |
+
task_type='CAUSAL_LM',
|
106 |
+
type='peft.LoraConfig'),
|
107 |
+
pretrained_pth=
|
108 |
+
'./work_dirs/llava_internlm_chat_7b_clip_vit_large_p14_336_e1_gpu8_pretrain/epoch_1.pth',
|
109 |
+
type='xtuner.model.LLaVAModel',
|
110 |
+
visual_encoder=dict(
|
111 |
+
pretrained_model_name_or_path='openai/clip-vit-large-patch14-336',
|
112 |
+
type='transformers.CLIPVisionModel.from_pretrained'),
|
113 |
+
visual_encoder_lora=dict(
|
114 |
+
bias='none',
|
115 |
+
lora_alpha=16,
|
116 |
+
lora_dropout=0.05,
|
117 |
+
r=64,
|
118 |
+
type='peft.LoraConfig'))
|
119 |
+
optim_type = 'torch.optim.AdamW'
|
120 |
+
optim_wrapper = dict(
|
121 |
+
optimizer=dict(
|
122 |
+
betas=(
|
123 |
+
0.9,
|
124 |
+
0.999,
|
125 |
+
),
|
126 |
+
lr=0.0002,
|
127 |
+
type='torch.optim.AdamW',
|
128 |
+
weight_decay=0),
|
129 |
+
type='DeepSpeedOptimWrapper')
|
130 |
+
param_scheduler = [
|
131 |
+
dict(
|
132 |
+
begin=0,
|
133 |
+
by_epoch=True,
|
134 |
+
convert_to_iter_based=True,
|
135 |
+
end=0.03,
|
136 |
+
start_factor=1e-05,
|
137 |
+
type='mmengine.optim.LinearLR'),
|
138 |
+
dict(
|
139 |
+
T_max=1,
|
140 |
+
begin=0.03,
|
141 |
+
by_epoch=True,
|
142 |
+
convert_to_iter_based=True,
|
143 |
+
eta_min=0.0,
|
144 |
+
type='mmengine.optim.CosineAnnealingLR'),
|
145 |
+
]
|
146 |
+
pretrained_pth = './work_dirs/llava_internlm_chat_7b_clip_vit_large_p14_336_e1_gpu8_pretrain/epoch_1.pth'
|
147 |
+
processor = dict(
|
148 |
+
pretrained_model_name_or_path='openai/clip-vit-large-patch14-336',
|
149 |
+
trust_remote_code=True,
|
150 |
+
type='transformers.CLIPImageProcessor.from_pretrained')
|
151 |
+
prompt_template = 'xtuner.utils.PROMPT_TEMPLATE.internlm_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=1,
|
167 |
+
gradient_clipping=1,
|
168 |
+
train_micro_batch_size_per_gpu=16,
|
169 |
+
type='xtuner.engine.DeepSpeedStrategy')
|
170 |
+
tokenizer = dict(
|
171 |
+
padding_side='right',
|
172 |
+
pretrained_model_name_or_path='internlm/internlm-chat-7b',
|
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=16,
|
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 |
+
max_length=1472,
|
185 |
+
pad_image_to_square=True,
|
186 |
+
processor=dict(
|
187 |
+
pretrained_model_name_or_path='openai/clip-vit-large-patch14-336',
|
188 |
+
trust_remote_code=True,
|
189 |
+
type='transformers.CLIPImageProcessor.from_pretrained'),
|
190 |
+
template_map_fn=dict(
|
191 |
+
template='xtuner.utils.PROMPT_TEMPLATE.internlm_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/internlm-chat-7b',
|
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_internlm_chat_7b_qlora_clip_vit_large_p14_336_lora_e1_gpu8_finetune'
|