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.

Train with Predefined Configurations

NVIDIA provides configurations for two Qwen2 model sizes: 7B and 13B.

Run Training

  1. To run Qwen2 training, update conf/config.yaml:

defaults:
  - training: qwen2/qwen2_7b

stages:
  - training
  1. Specify qwen2 and the model size you want for training configuration and qwen2/qwen2_<model_size>.

  2. Execute the launcher pipeline: python3 main.py.

Configure Settings

Default configurations for model size specific training can be found in the folder conf/training/qwen2. The configuration is divided into four sections run, trainer, exp_manager, and model.

  1. To configure:

run:
  name: qwen2_7b
  results_dir: ${base_results_dir}/${.name}
  time_limit: "0-04:00:00"
  dependency: "singleton"
  1. Set the number of nodes and devices for training:

trainer:
  num_nodes: 16
  devices: 8
  max_steps: 300000 # consumed_samples = global_step * global_batch_size
  max_time: "05:23:30:00" # days:hours:minutes:seconds
  1. Set the configurations for creating a checkpoint:

exp_manger:
  create_checkpoint_callback: True
  checkpoint_callback_params:
    monitor: val_loss
    save_top_k: 10
    mode: min
    always_save_nemo: False # saves nemo file during validation, not implemented for model parallel
    save_nemo_train_end: False # not recommended when training large models on clusters with short time limits
    filename: 'megatron_qwen2--{val_loss:.2f}-{step}-{consumed_amples}'
    model_parallel_size: ${multiply:${training.model.tensor_model_parallel_size}, ${training.model.pipeline_model_parallel_size}}
  1. Set the wandb configurations:

exp_manager:
  create_wandb_logger: True
  wandb_logger_kwargs:
    project: nemo_qwen2
    name: ${training.run.name}
  1. Set the tensor parallel and pipeline parallel size:

model:
  tensor_model_parallel_size: 1
  pipeline_model_parallel_size: 1
  1. Set the data distribution configuration:

model:
  data:
    data_prefix:
    - .0333
    - ${data_dir}/my-qwen2_00_text_document
    - .0333
    - ${data_dir}/my-qwen2_00_text_document