Skip to content

Commit c38cccb

Browse files
committed
readme draft
1 parent abe44c0 commit c38cccb

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

recipes/quickstart/finetuning/datasets/vqa_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def tokenize_dialog(dialog, images, processor):
6060
# pixel_values = batch["pixel_values"],
6161
# image_sizes = batch["image_sizes"]
6262
# print("combined_tokens",combined_tokens[image_sizes])
63-
63+
6464
return combined_tokens
6565
def image_tokenize(sample, processor):
6666
processor.tokenizer.padding_side = "right" # during training, one always uses padding on the right
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Fine-Tuning Meta Llama Multi Modal Models recipe
2+
Here we discuss fine-tuning Meta Llama 3.2 11B and 90B models.
3+
4+
### Concepts
5+
Model Architecture
6+
Our Meta Llama 3.2 11B and 90B models consist of two main components: (1) an image encoder, (2) an image adapter.
7+
8+
[Model Architecture PICTURE]
9+
10+
We need have a new processor class added, that will handle the image processing and text tokenization. A processor example looks like this:
11+
12+
13+
14+
### Fine-tuning steps
15+
1. Download the dataset:
16+
an example of the dataset looks like this:
17+
2. Processor example looks like this
18+
19+
3. Load the dataset
20+
21+
Full-finetune
22+
```bash
23+
torchrun --nnodes 1 --nproc_per_node 4 recipes/quickstart/finetuning/finetuning.py --enable_fsdp --lr 1e-5 --context_length 8192 --num_epochs 1 --batch_size_training 1 --model_name llava-hf/llama3-llava-next-8b-hf --dist_checkpoint_root_folder /home/kaiwu/work/fb_connect/finetune_model --dist_checkpoint_folder fine-tuned --use_fast_kernels --dataset "custom_dataset" --custom_dataset.test_split "test" --custom_dataset.file "recipes/quickstart/finetuning/datasets/vqa_dataset.py" --use-wandb --run_validation True
24+
```
25+
26+
LoRA:
27+
```bash
28+
torchrun --nnodes 1 --nproc_per_node 4 recipes/quickstart/finetuning/finetuning.py --enable_fsdp --lr 1e-5 --context_length 8192 --num_epochs 1 --batch_size_training 1 --model_name llava-hf/llama3-llava-next-8b-hf --dist_checkpoint_root_folder /home/kaiwu/work/fb_connect/finetune_model --dist_checkpoint_folder fine-tuned --use_fast_kernels --dataset "custom_dataset" --custom_dataset.test_split "test" --custom_dataset.file "recipes/quickstart/finetuning/datasets/vqa_dataset.py" --use-wandb --run_validation True
29+
```

0 commit comments

Comments
 (0)