nemo_automodel.recipes.llm.benchmark
nemo_automodel.recipes.llm.benchmark
Module Contents
Classes
Functions
Data
API
Bases: TrainFinetuneRecipeForNextTokenPrediction
Benchmarking recipe for next-token prediction.
This class extends TrainFinetuneRecipeForNextTokenPrediction to provide a simplified benchmarking-focused training loop with timers and profiling support. It reuses the setup() and _forward_backward_step() methods from the parent class.
benchmark.flops_scope defaults to “model”. Explicit “text” scope counts only the text backbone over the complete measured iteration time; vision encoder and projector FLOPs are excluded.
TFLOPs added by a Multi-Token-Prediction (MTP) head, if the model has one.
The backbone FLOPs formula omits the MTP head, and the HF config retains only the
physical depth count (and no per-depth block pattern). So read the EFFECTIVE settings
from the built model: mtp_config.num_layers (depths actually run),
mtp_config.use_repeated_layer, and the per-sublayer block_type from
mtp.layers. Returns 0.0 when the model has no enabled MTP head.
Run the benchmarking loop.
This method implements a simplified training loop focused on benchmarking with timers and profiling support, similar to the original benchmarking script.
Setup the benchmarking environment.
This method calls the parent’s setup() but adapts it for benchmarking purposes. It skips validation dataloader, checkpointing, and other training-specific features.
Infer vocab_size from a model config, handling custom config classes and VL composite configs.
Parameters:
The model config section (cfg.model) containing target, config, etc.
Returns:
The vocab_size integer, or raises AttributeError if not found.
Main entry point for the benchmarking recipe.
Loads the configuration, sets up the recipe, and runs the benchmark.