NVIDIA-NeMo / NVIDIA-NeMo/Automodel

Callback support for finetune recipe

Open
#805 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
963
Forks
318
Avg merge
3d 20h
Merged PRs (30d)
143

Description

Is your feature request related to a problem? Please describe.

We are integrating Customizer to use Automodel now for finetuning and need to support metrics support.

Previously, when we used NeMo for training, this was straightforward because NeMo is built on PyTorch Lightning, which has native callback support. We simply added a NeMoCustomizerCallback to report training progress to our API.

But with Automodel, my understanding is that it doesn't use PyTorch Lightning, so I can't just hook our callback. The simplest approach I can find is to subclass [TrainFinetuneRecipeForNextTokenPrediction](https://github.com/NVIDIA-NeMo/Automodel/blob/main/nemo_automodel/recipes/llm/train_ft.py#L853) to override setup(), log_train_metrics(), log_val_metrics() methods to call our callback, but it doesn't seem to be the perfect solution.

Describe the solution you'd like

Could you add a callback mechanism similar to PyTorch Lightning's callbacks? Ideally with hooks for:

  • on_train_start (after setup)
  • on_train_batch_end (after each optimizer step)
  • on_validation_end (after validation)
  • on_save_checkpoint (when checkpoint is saved)
  • on_exception (on training failure)

This would help us maintain cleaner integration with Customizer

Describe alternatives you've considered

subclass [TrainFinetuneRecipeForNextTokenPrediction](https://github.com/NVIDIA-NeMo/Automodel/blob/main/nemo_automodel/recipes/llm/train_ft.py#L853) to override setup(), log_train_metrics(), log_val_metrics() methods to call our callback

Additional context
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with nemo_automodel/recipes/llm/train_ft.py at TrainFinetuneRecipeForNextTokenPrediction and read setup(), log_train_metrics(), and log_val_metrics(). Map the requested callback points to the finetune lifecycle, including checkpoint saving and exception handling. Done means the recipe exposes the requested callback hooks without requiring a subclass for Customizer integration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.