Important

NeMo 2.0 is an experimental feature and currently released in the dev container only: nvcr.io/nvidia/nemo:dev. Please refer to NeMo 2.0 overview for information on getting started.

Parameter Efficient Fine-Tuning (PEFT)

Run PEFT with NeMo Launcher

  1. To run PEFT, update conf/config.yaml:

defaults:
  - peft: qwen2/squad

stages:
  - peft
  1. Execute the launcher pipeline: python3 main.py.

Configure Settings

You can find default configurations for PEFT with squad in conf/peft/qwen2/squad.yaml. Fine-tuning configuration is divided into four sections run, trainer, exp_manger and model.

  1. To configure:

run:
  name: peft_qwen2_7b
  time_limit: "04:00:00"
  dependency: "singleton"
  convert_name: convert_nemo
  model_train_name: qwen2_7b
  convert_dir: ${base_results_dir}/${peft.run.model_train_name}/${peft.run.convert_name}
  task_name: "squad"
  results_dir: ${base_results_dir}/${.model_train_name}/peft_${.task_name}
  1. Set the number of nodes and devices for fine-tuning:

trainer:
  num_nodes: 1
  devices: 8
model:
  restore_from_path: ${peft.run.convert_dir}/results/megatron_qwen2.nemo

restore_from_path sets the path to the .nemo checkpoint to run fine-tuning.

  1. Set the tensor parallel and pipeline parallel size for the different model sizes.

For 7B PEFT, set:

model:
    tensor_model_parallel_size: 1
    pipeline_model_parallel_size: 1

For 13B PEFT, set:

model:
    tensor_model_parallel_size: 2
    pipeline_model_parallel_size: 1
  1. Set the PEFT-specific configuration:

model:
    peft:
        peft_scheme: "lora"

peft_scheme sets the fine-tuning scheme to be used. Supported schemes include: lora, ptuning.