Spaces:
Running
on
Zero
Running
on
Zero
File size: 4,018 Bytes
f06aba5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
## Tainging Example
### 1. training example for sft or lora
- Data format
You need to create a jsonl file with key-values in the table below:
| key_word | Required | Description | Example |
|:---------------:| :------: |:----------------:|:-----------:|
| `img_path` | Required | image path | `./data_example/images/0.png` |
| `prompt` | Required | text | `A lovely little girl.` |
| `width` | Required | image width | ` 1024 ` |
| `height` | Required | image height | ` 1024 ` |
- Tainging Scripts
```bash
bash ./examples/sft/train.sh
# All training setting in train_config.yaml
# --data_csv_root: data csv_filepath
# --aspect_ratio_type: data bucketing strategy, mar_256、mar_512、mar_1024
# --pretrained_model_name_or_path: root directory of the model
# --diffusion_pretrain_weight: if a specified diffusion weight path is provided, load the model parameters from the current directory.
# --work_dir: the save root directory for ckpt and logs
# --resume_from_checkpoint: If 'resume_from_checkpoint' is set to 'latest', load the most recent step checkpoint. If a specific directory is provided, resume training from that directory.
```
### 2. training example for dpo
- Data format
You need to create a txt file with key-values in the table below:
| key_word | Required | Description | Example |
|:---------------:| :------: |:----------------:|:-----------:|
| `img_path_win` | Required | win image path | `./data_example/images/0.png` |
| `img_path_lose` | Required | lose image path | `./data_example/images/1.png` |
| `prompt` | Required | text | `A lovely little girl.` |
| `width` | Required | image width | ` 1024 ` |
| `height` | Required | image height | ` 1024 ` |
- Tainging Scripts
```bash
bash ./examples/dpo/train.sh
# All training setting in train_config.yaml
# --data_txt_root: data txt_filepath
# --aspect_ratio_type: data bucketing strategy, mar_256、mar_512、mar_1024
# --pretrained_model_name_or_path: root directory of the model
# --diffusion_pretrain_weight: if a specified diffusion weight path is provided, load the model parameters from the current directory.
# --work_dir: the save root directory for ckpt and logs
# --resume_from_checkpoint: If 'resume_from_checkpoint' is set to 'latest', load the most recent step checkpoint. If a specific directory is provided, resume training from that directory.
```
### 3. training example for image-edit
- Data format
You need to create a txt file with key-values in the table below:
| key_word | Required | Description | Example |
|:---------------:| :------: |:----------------:|:-----------:|
| `img_path` | Required | edited image path | `./data_example/images/0_edited.png` |
| `ref_img_path` | Required | raw image path | `./data_example/images/0.png` |
| `prompt` | Required | edit instruction | `change the dog to cat.` |
| `width` | Required | image width | ` 1024 ` |
| `height` | Required | image height | ` 1024 ` |
- Tainging Scripts
```bash
bash ./examples/edit/train.sh
# All training setting in train_config.yaml
# --data_txt_root: data txt_filepath
# --aspect_ratio_type: data bucketing strategy, mar_256、mar_512、mar_1024
# --pretrained_model_name_or_path: root directory of the model
# --diffusion_pretrain_weight: if a specified diffusion weight path is provided, load the model parameters from the current directory.
# --work_dir: the save root directory for ckpt and logs
# --resume_from_checkpoint: If 'resume_from_checkpoint' is set to 'latest', load the most recent step checkpoint. If a specific directory is provided, resume training from that directory.
```
|