Views
No views yet
| Dataset | Samples | Description |
|---|---|---|
| jasonkung98/NVIDIA-Nemotron-Model-Reasoning-Challenge | 9,500 | Competition training data (bit manipulation, ciphers, number systems, cryptarithms) |
| nvidia/Nemotron-RL-ReasoningGym-v1 | ~14,259 | 104 diverse puzzle/logic task types (cryptarithms, matrix ops, equations, Tower of Hanoi, palindromes, etc.) |
| nvidia/AceReason-1.1-SFT | 5,000 | Math reasoning with real chain-of-thought traces from DeepSeek-R1 |
| Parameter | Value |
|---|---|
| Epochs | 3 |
| Batch size (effective) | 16 (2 × 8 grad accum) |
| Learning rate | 2e-4 (cosine schedule) |
| Warmup | 5% of steps |
| Max sequence length | 4096 |
| Precision | BF16 + 4-bit NF4 quantization |
| Optimizer | AdamW |
| Weight decay | 0.01 |
1# Install dependencies
2pip install torch transformers trl peft datasets accelerate bitsandbytes trackio huggingface_hub sentencepiece protobuf
3
4# Run training (requires GPU with >= 16GB VRAM)
5python train_nemotron_lora.py1from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
2from peft import PeftModel
3import torch
4
5# Load with QLoRA
6bnb_config = BitsAndBytesConfig(
7 load_in_4bit=True, bnb_4bit_quant_type="nf4",
8 bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_use_double_quant=True
9)
10model = AutoModelForCausalLM.from_pretrained(
11 "nvidia/Llama-3.1-Nemotron-Nano-8B-v1",
12 quantization_config=bnb_config, torch_dtype=torch.bfloat16, device_map="auto"
13)
14model = PeftModel.from_pretrained(model, "GaryNENE/nemotron-nano-8b-reasoning-lora")
15model.eval()
16
17tokenizer = AutoTokenizer.from_pretrained("nvidia/Llama-3.1-Nemotron-Nano-8B-v1")
18
19# Generate with reasoning toggle ON
20messages = [
21 {"role": "system", "content": "detailed thinking on"},
22 {"role": "user", "content": "Your puzzle/reasoning question here..."},
23]
24input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
25inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
26outputs = model.generate(**inputs, max_new_tokens=32768, temperature=0.6, top_p=0.95, do_sample=True)
27print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))