Skip to content

Commit

Permalink
move target module specification to performance recipe only (#11334)
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Cui <[email protected]>
  • Loading branch information
cuichenx authored Nov 20, 2024
1 parent fcd128e commit 3d8bcc8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion nemo/collections/llm/recipes/llama31_405b.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ def finetune_recipe(
recipe.peft = run.Config(LoRA)
recipe.peft.dim = 16
recipe.peft.alpha = 32
recipe.peft.target_modules = ['linear_qkv']
recipe.optim.config.use_distributed_optimizer = False

# some settings currently do not function correctly with LoRA
Expand Down Expand Up @@ -387,6 +386,7 @@ def finetune_performance_optimizations(
recipe.trainer.strategy.tensor_model_parallel_size = 4
recipe.trainer.strategy.pipeline_model_parallel_size = 6
recipe.trainer.strategy.virtual_pipeline_model_parallel_size = 7
recipe.peft.target_modules = ['linear_qkv']

recipe.trainer.strategy.sequence_parallel = True

Expand Down
2 changes: 1 addition & 1 deletion nemo/collections/llm/recipes/llama31_70b.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ def finetune_recipe(
recipe.peft = run.Config(LoRA)
recipe.peft.dim = 16
recipe.peft.alpha = 32
recipe.peft.target_modules = ['linear_qkv']
recipe.optim.config.use_distributed_optimizer = False

# some settings currently do not function correctly with LoRA
Expand Down Expand Up @@ -388,6 +387,7 @@ def finetune_performance_optimizations(
recipe.trainer.strategy.tensor_model_parallel_size = 2
recipe.trainer.strategy.pipeline_model_parallel_size = 4
recipe.trainer.strategy.virtual_pipeline_model_parallel_size = 5
recipe.peft.target_modules = ['linear_qkv']

recipe.trainer.strategy.sequence_parallel = True

Expand Down
3 changes: 2 additions & 1 deletion nemo/collections/llm/recipes/llama31_8b.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ def finetune_recipe(
recipe.peft = run.Config(LoRA)
recipe.peft.dim = 8
recipe.peft.alpha = 16
recipe.peft.target_modules = ['linear_qkv']
recipe.optim.config.use_distributed_optimizer = False

# some settings currently do not function correctly with LoRA
Expand Down Expand Up @@ -372,6 +371,8 @@ def finetune_performance_optimizations(
tp_comm_overlap=False,
)
)
else:
recipe.peft.target_modules = ['linear_qkv']

recipe.trainer.callbacks.append(run.Config(TimingCallback))
recipe.trainer.callbacks.append(
Expand Down
2 changes: 1 addition & 1 deletion nemo/collections/llm/recipes/llama3_70b.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ def finetune_recipe(
recipe.peft = run.Config(LoRA)
recipe.peft.dim = 16
recipe.peft.alpha = 32
recipe.peft.target_modules = ['linear_qkv']
recipe.optim.config.use_distributed_optimizer = False

# some settings currently do not function correctly with LoRA
Expand Down Expand Up @@ -385,6 +384,7 @@ def finetune_performance_optimizations(
recipe.trainer.strategy.tensor_model_parallel_size = 2
recipe.trainer.strategy.pipeline_model_parallel_size = 4
recipe.trainer.strategy.virtual_pipeline_model_parallel_size = 5
recipe.peft.target_modules = ['linear_qkv']

recipe.trainer.strategy.sequence_parallel = True

Expand Down
3 changes: 2 additions & 1 deletion nemo/collections/llm/recipes/llama3_8b.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ def finetune_recipe(
recipe.peft = run.Config(LoRA)
recipe.peft.dim = 8
recipe.peft.alpha = 16
recipe.peft.target_modules = ['linear_qkv']
recipe.optim.config.use_distributed_optimizer = False

# some settings currently do not function correctly with LoRA
Expand Down Expand Up @@ -356,6 +355,8 @@ def finetune_performance_optimizations(
tp_comm_overlap=False,
)
)
else:
recipe.peft.target_modules = ['linear_qkv']

recipe.trainer.callbacks.append(run.Config(TimingCallback))
recipe.trainer.callbacks.append(
Expand Down
1 change: 0 additions & 1 deletion nemo/collections/llm/recipes/phi3_mini_4k_instruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ def finetune_recipe(
recipe.peft = run.Config(LoRA)
recipe.peft.dim = 8
recipe.peft.alpha = 16
recipe.peft.target_modules = ['linear_qkv']
recipe.optim.config.use_distributed_optimizer = False

# some settings currently do not function correctly with LoRA
Expand Down

0 comments on commit 3d8bcc8

Please sign in to comment.