Skip to content

Commit

Permalink
update recipes
Browse files Browse the repository at this point in the history
Signed-off-by: yaoyu-33 <[email protected]>
  • Loading branch information
yaoyu-33 committed Nov 22, 2024
1 parent 6b2b5e9 commit 29572dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions nemo/collections/vlm/recipes/mllama_11b.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def finetune_recipe(
recipe.trainer.strategy.tensor_model_parallel_size = 2
recipe.optim.config.lr = 2e-05
elif peft_scheme.lower() == 'lora':
# pylint: disable=line-too-long
"""Adapted from https://github.com/meta-llama/llama-recipes/blob/main/src/llama_recipes/configs/peft.py"""
recipe.peft = run.Config(
vlm.LoRA,
freeze_vision_model=True,
Expand Down
17 changes: 10 additions & 7 deletions nemo/collections/vlm/recipes/mllama_90b.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,20 @@ def finetune_recipe(
if peft_scheme is None or peft_scheme.lower() == 'none':
raise ValueError("Full finetuning recipe for Llama-3.2-90B model will be supported soon.")
elif peft_scheme.lower() == 'lora':
# pylint: disable=line-too-long
"""Adapted from https://github.com/meta-llama/llama-recipes/blob/main/src/llama_recipes/configs/peft.py"""
recipe.peft = run.Config(
vlm.LoRA,
freeze_vision_model=False,
freeze_vision_model=True,
target_modules=[
"*.language_model.*.linear_qkv",
"*.language_model.*.linear_q",
"*.language_model.*.linear_kv",
"*.language_model.*.linear_proj",
"*.language_model.*.linear_fc1",
"*.language_model.*.linear_fc2",
"linear_qkv",
"linear_q",
"linear_kv",
],
dim=8,
alpha=32,
dropout=0.05,
dropout_position="pre",
)
recipe.optim.config.lr = 1e-4
else:
Expand Down

0 comments on commit 29572dd

Please sign in to comment.