-
-
Notifications
You must be signed in to change notification settings - Fork 874
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multimodal Vision Llama - rudimentary support (#1940)
--------- Co-authored-by: Sunny <[email protected]> Co-authored-by: sunny <[email protected]>
- Loading branch information
1 parent
8443310
commit e1915f5
Showing
24 changed files
with
799 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# MultiModal / Vision Language Models (BETA) | ||
|
||
### Supported Models | ||
|
||
- Mllama, i.e. llama with vision models | ||
|
||
### Usage | ||
|
||
Currently multimodal support is limited and doesn't have full feature parity. To finetune a multimodal Llama w/ LoRA, | ||
you'll need to use the following in YAML in combination with the rest of the required hyperparams. | ||
|
||
```yaml | ||
base_model: alpindale/Llama-3.2-11B-Vision-Instruct | ||
processor_type: AutoProcessor | ||
skip_prepare_dataset: true | ||
|
||
chat_template: llama3_2_vision | ||
datasets: | ||
- path: HuggingFaceH4/llava-instruct-mix-vsft | ||
type: chat_template | ||
split: train[:1%] | ||
field_messages: messages | ||
remove_unused_columns: false | ||
sample_packing: false | ||
|
||
# only finetune the Language model, leave the vision model and vision tower frozen | ||
lora_target_modules: 'language_model.model.layers.[\d]+.(mlp|cross_attn|self_attn).(up|down|gate|q|k|v|o)_proj' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
base_model: alpindale/Llama-3.2-11B-Vision-Instruct | ||
processor_type: AutoProcessor | ||
strict: false | ||
|
||
# these 3 lines are needed for now to handle vision chat templates w images | ||
skip_prepare_dataset: true | ||
remove_unused_columns: false | ||
sample_packing: false | ||
|
||
chat_template: llama3_2_vision | ||
datasets: | ||
- path: HuggingFaceH4/llava-instruct-mix-vsft | ||
type: chat_template | ||
split: train[:1%] | ||
field_messages: messages | ||
dataset_prepared_path: last_run_prepared | ||
val_set_size: 0.0 | ||
output_dir: ./outputs/out | ||
|
||
adapter: lora | ||
lora_model_dir: | ||
|
||
sequence_len: 8192 | ||
pad_to_sequence_len: false | ||
|
||
lora_r: 32 | ||
lora_alpha: 16 | ||
lora_dropout: 0.05 | ||
lora_target_modules: 'language_model.model.layers.[\d]+.(mlp|cross_attn|self_attn).(up|down|gate|q|k|v|o)_proj' | ||
|
||
wandb_project: | ||
wandb_entity: | ||
wandb_watch: | ||
wandb_name: | ||
wandb_log_model: | ||
|
||
gradient_accumulation_steps: 4 | ||
micro_batch_size: 1 | ||
num_epochs: 1 | ||
optimizer: adamw_bnb_8bit | ||
lr_scheduler: cosine | ||
learning_rate: 0.0002 | ||
|
||
train_on_inputs: false | ||
group_by_length: false | ||
bf16: true | ||
fp16: | ||
tf32: true | ||
|
||
gradient_checkpointing: true | ||
local_rank: | ||
logging_steps: 1 | ||
flash_attention: true | ||
eager_attention: | ||
|
||
warmup_ratio: 0.1 | ||
evals_per_epoch: 1 | ||
saves_per_epoch: 1 | ||
debug: | ||
deepspeed: | ||
weight_decay: 0.0 | ||
fsdp: | ||
fsdp_config: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.