Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-internlm2-7b is a LLaVA model fine-tuned from [InternLM2-Chat-7B](https://huggingface.co/internlm/internlm2-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/internlm2-chat-7b \
|
35 |
+
--visual-encoder openai/clip-vit-large-patch14-336 \
|
36 |
+
--llava xtuner/llava-internlm2-7b \
|
37 |
+
--prompt-template internlm2_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_internlm2_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_internlm2_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/internlm2-chat-7b \
|
62 |
+
--visual-encoder openai/clip-vit-large-patch14-336 \
|
63 |
+
--llava xtuner/llava-internlm2-7b \
|
64 |
+
--prompt-template internlm2_chat \
|
65 |
+
--data-path $MMBENCH_DATA_PATH \
|
66 |
+
--work-dir $RESULT_PATH
|
67 |
+
```
|
68 |
+
|
69 |
+
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!
|
70 |
+
|
71 |
+
## Citation
|
72 |
+
|
73 |
+
```bibtex
|
74 |
+
@misc{2023xtuner,
|
75 |
+
title={XTuner: A Toolkit for Efficiently Fine-tuning LLM},
|
76 |
+
author={XTuner Contributors},
|
77 |
+
howpublished = {\url{https://github.com/InternLM/xtuner}},
|
78 |
+
year={2023}
|
79 |
+
}
|
80 |
+
```
|