Init: add readme
Browse files
READMD.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TODO:
|
| 2 |
+
- [x] Save LoRA separately
|
| 3 |
+
- [ ] Load LoRA separately
|
| 4 |
+
- [ ] Merge LoRA
|
| 5 |
+
|
| 6 |
+
# How to use
|
| 7 |
+
1. Setup the environment
|
| 8 |
+
```bash
|
| 9 |
+
conda create -n llava python=3.10 -y
|
| 10 |
+
conda activate llava
|
| 11 |
+
pip install --upgrade pip # Enable PEP 660 support.
|
| 12 |
+
pip install -e ".[train]"
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
2. Dataset
|
| 16 |
+
The dataset is stored in a json file. Each item is in the following format:
|
| 17 |
+
```json
|
| 18 |
+
{
|
| 19 |
+
"id": "<id>",
|
| 20 |
+
"image": "/path/to/image",
|
| 21 |
+
"conversations": [
|
| 22 |
+
{
|
| 23 |
+
"from": "human",
|
| 24 |
+
"value": "<question>"
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"from": "gpt",
|
| 28 |
+
"value": "<answer>"
|
| 29 |
+
}
|
| 30 |
+
],
|
| 31 |
+
...
|
| 32 |
+
}
|
| 33 |
+
```
|
| 34 |
+
Modify the `--data_path` flag, which should be a folder containing `train.json` and `test.json`.
|
| 35 |
+
|
| 36 |
+
3. Pre-trained ckpt
|
| 37 |
+
Usually, huggingface will download the pretrained ckpt automatically. But sometimes it will take a lot of time if the server is in mainland. Alternatively, you can find the pretrained ckpt under `61.170.32.4:/mnt1/lyc/huggingface/hub`.
|
| 38 |
+
|
| 39 |
+
4. Finetuning
|
| 40 |
+
Sample bash
|
| 41 |
+
```bash
|
| 42 |
+
bash scripts/finetune/train_llava.sh
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
5. Testing
|
| 47 |
+
Sample bash
|
| 48 |
+
```bash
|
| 49 |
+
bash scripts/finetune/test_llava.sh
|
| 50 |
+
```
|
| 51 |
+
|