Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-v1.5-7b-xtuner is a LLaVA model fine-tuned from [Vicuna-v1.5-7B](https://huggingface.co/lmsys/vicuna-7b-v1.5) 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 lmsys/vicuna-7b-v1.5 \
|
35 |
+
--visual-encoder openai/clip-vit-large-patch14 \
|
36 |
+
--llava xtuner/llava-v1.5-7b-xtuner \
|
37 |
+
--prompt-template vicuna \
|
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_vicuna_v15_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_vicuna_v15_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 lmsys/vicuna-7b-v1.5 \
|
62 |
+
--visual-encoder openai/clip-vit-large-patch14 \
|
63 |
+
--llava xtuner/llava-v1.5-7b-xtuner \
|
64 |
+
--prompt-template vicuna \
|
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 |
+
```
|