| # Training Pipeline |
|
|
| Fine-tune Nemotron Nano 12B v2 VL on AWS service documentation so the model has built-in knowledge of new/recent AWS services and features. |
|
|
| ## Overview |
|
|
| - **Base model**: `nvidia/NVIDIA-Nemotron-Nano-12B-v2-VL-BF16` |
| - **Method**: QLoRA (4-bit quantization + LoRA adapters) |
| - **Data**: AWS documentation converted to instruction-response pairs |
| - **Target**: Push fine-tuned model to HF Hub for deployment |
|
|
| ## Directory Structure |
|
|
| ``` |
| training/ |
| βββ prepare_data.py # Convert raw docs β training JSONL |
| βββ train.py # QLoRA fine-tuning script |
| βββ push_to_hub.py # Merge adapter + push to HF Hub |
| βββ requirements.txt # Training dependencies |
| βββ data/ |
| βββ raw/ # Put AWS documentation markdown files here |
| βββ train.jsonl # Generated training data (output of prepare_data.py) |
| ``` |
|
|
| ## Steps |
|
|
| ### 1. Gather AWS documentation |
|
|
| Add markdown files to `training/data/raw/`. One file per service or feature: |
|
|
| ``` |
| training/data/raw/ |
| βββ amazon-q.md |
| βββ s3-express-one-zone.md |
| βββ aurora-serverless-v2.md |
| βββ bedrock.md |
| βββ ... |
| ``` |
|
|
| ### 2. Generate training data |
|
|
| ```bash |
| python training/prepare_data.py |
| ``` |
|
|
| This reads the raw docs and creates `training/data/train.jsonl` with instruction-response pairs. |
|
|
| ### 3. Train on AWS (EC2 with GPU) |
|
|
| ```bash |
| pip install -r training/requirements.txt |
| python training/train.py |
| ``` |
|
|
| Recommended: `g5.2xlarge` (A10G, 24GB VRAM) or `p3.2xlarge` (V100, 16GB). |
|
|
| ### 4. Push to Hugging Face Hub |
|
|
| ```bash |
| python training/push_to_hub.py |
| ``` |
|
|
| ### 5. Update app.py |
|
|
| Change `MODEL_ID` in `app.py` to point at your fine-tuned model. |
|
|