Skip to content

Commit 6fad2df

Browse files
authored
Add example for Text2SQL LoRA on Nemotron 3 Nano 30B with NeMo Automodel (#76)
Change adds an end to end example for Text2SQL finetuning of Nemotron 3 Nano 30BA3B using BIRD SQL dataset with NeMo Automodel. Signed-off-by: PJ Loury <ploury@nvidia.com>
1 parent 9e4e754 commit 6fad2df

File tree

3 files changed

+632
-6
lines changed

3 files changed

+632
-6
lines changed
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
# LoRA Fine-Tuning & Deployment of Nemotron for SQL using [Megatron Bridge](https://github.com/NVIDIA-NeMo/Megatron-Bridge)
1+
# LoRA Fine-Tuning & Deployment of Nemotron 3 Nano for Text2SQL
22

3+
End-to-end guide for LoRA fine-tuning **NVIDIA Nemotron-3-Nano-30B** on a text-to-SQL task (BIRD SQL) and deploying with NVIDIA NIM or vLLM. Two notebook options:
34

4-
End-to-end guide for LoRA fine-tuning **NVIDIA Nemotron-3-Nano-30B** on a text-to-SQL task (BIRD SQL) and deploying with NVIDIA NIM or vLLM.
5+
- **AutoModel** – Uses the [NeMo AutoModel](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/nemo/containers/nemo-automodel) container for training and checkpointing.
6+
- **Megatron Bridge** – Uses [Megatron Bridge](https://github.com/NVIDIA-NeMo/Megatron-Bridge) for training.
57

68
## What's Inside
79

810
| File | Description |
911
|------|-------------|
10-
| `finetuning_deployment_guide_mbridge.ipynb` | Full walkthrough notebook |
11-
| `bird_sql/` | Dataset preparation helpers (BIRD SQL → chat-templated JSONL) |a
12+
| `finetuning_deployment_guide_automodel.ipynb` | Full walkthrough (NeMo AutoModel) |
13+
| `finetuning_deployment_guide_mbridge.ipynb` | Full walkthrough (Megatron Bridge) |
14+
| `bird_sql/` | Dataset preparation helpers (BIRD SQL → chat-templated JSONL) |
1215

1316
## Quick Start
1417

15-
[![Deploy on Brev](https://brev-assets.s3.us-west-1.amazonaws.com/nv-lb-dark.svg)](https://brev.nvidia.com/launchable/deploy?launchableID=env-39PnUMhHmxbMcHKO61iQ8O5F7ZL)
18+
Open either notebook to get started. A **Deploy on Brev** one-click option is also available for the Megatron Bridge example:
1619

17-
Or open the notebook and follow along step by step.
20+
[![Deploy on Brev](https://brev-assets.s3.us-west-1.amazonaws.com/nv-lb-dark.svg)](https://brev.nvidia.com/launchable/deploy?launchableID=env-39PnUMhHmxbMcHKO61iQ8O5F7ZL)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from __future__ import annotations
16+
17+
import os
18+
19+
from nemo_automodel.components.config._arg_parser import parse_args_and_load_config
20+
from nemo_automodel.recipes.llm.train_ft import TrainFinetuneRecipeForNextTokenPrediction
21+
22+
# Default config: YAML in the same directory as this script (BIRD SQL PEFT for Nemotron-3-Nano, 2 GPUs)
23+
_THIS_DIR = os.path.dirname(os.path.abspath(__file__))
24+
_DEFAULT_CONFIG = os.path.join(_THIS_DIR, "bird_peft_nemotron_nano.yaml")
25+
26+
27+
def main(default_config_path: str = _DEFAULT_CONFIG) -> None:
28+
"""Main entry point for the fine-tuning recipe.
29+
30+
Loads the configuration, sets up the recipe, and initiates the training loop.
31+
Override the config path via CLI: --config /path/to/other.yaml
32+
"""
33+
cfg = parse_args_and_load_config(default_config_path)
34+
recipe = TrainFinetuneRecipeForNextTokenPrediction(cfg)
35+
recipe.setup()
36+
recipe.run_train_validation_loop()
37+
38+
39+
if __name__ == "__main__":
40+
main()

0 commit comments

Comments
 (0)