Instructions to use shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M # Run inference directly in the terminal: llama cli -hf shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M # Run inference directly in the terminal: llama cli -hf shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
Use Docker
docker model run hf.co/shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
- SGLang
How to use shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling with Ollama:
ollama run hf.co/shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
- Unsloth Desktop
- Pi
How to use shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling with Docker Model Runner:
docker model run hf.co/shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
- Lemonade
How to use shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
Run and chat with the model
lemonade run user.NDP-Nemotron-3-Nano-4B-tool-calling-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
NDP Nemotron-3 Nano 4B — Tool Calling
Fine-tune of unsloth/NVIDIA-Nemotron-3-Nano-4B
on synthetic tool-use traces for the National Data Platform (NDP)
MCP server. The model emits <tool_call> blocks invoking three NDP catalog tools:
list_organizations, search_datasets, and get_dataset_details.
Quick stats
| Base model | unsloth/NVIDIA-Nemotron-3-Nano-4B (hybrid Mamba+Attention, 4B params) |
| Training method | LoRA (r=8, alpha=16) via Unsloth + TRL SFTTrainer |
| Training data | 1299 synthetic NDP tool-use examples, generated with gpt-oss:120b as teacher and curated with LLM-as-judge (threshold 7.0) |
| Steps / epochs | 980 steps (~3 epochs) |
| Final train loss | 0.0266 |
| Training time | 2725 s on 1× NVIDIA GH200 |
| Peak VRAM | 43.9 GB |
| Max seq length | 4096 |
Intended use
This model is for tool-call generation against the NDP MCP server. Given a natural-language
NDP query plus the three-tool catalog as tools=... to apply_chat_template, the model
produces a tool call in Nemotron's XML format:
<tool_call>
<function=search_datasets>
<parameter=search_terms>
["climate"]
</parameter>
<parameter=server>
global
</parameter>
</function>
</tool_call>
NDP tool surface trained on
| tool | purpose |
|---|---|
list_organizations(name_filter?, server?) |
List data publishers, optionally filtered |
search_datasets(...) |
Simple (search_terms[]) or advanced (owner_org, resource_format, filter_list, …) dataset search |
get_dataset_details(dataset_identifier, identifier_type?, server?) |
Full metadata by UUID or name slug |
Tool catalog source-of-truth: configs/tools/ndp_tools.json.
Inference
The Nemotron-3 Nano family needs:
transformers>=5.3,<=5.5.0(usesTokenizersBackendintroduced in v5; capped by unsloth-zoo)mamba_ssm==2.2.5+causal_conv1d==1.5.2(CUDA kernels compiled for your arch)use_cache=Falseingenerate()(current Nemotron-H modeling has a bug with cache_position)
import torch
# COMPAT: mamba_ssm 2.2.5 imports a class removed in transformers v5
import transformers.generation as _g, transformers.generation.utils as _gu
for cls in ("GreedySearchDecoderOnlyOutput", "SampleDecoderOnlyOutput"):
if not hasattr(_g, cls):
setattr(_g, cls, getattr(_gu, "GenerateDecoderOnlyOutput", _gu.ModelOutput))
from unsloth import FastLanguageModel
model, tok = FastLanguageModel.from_pretrained("shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling", max_seq_length=4096, trust_remote_code=True)
FastLanguageModel.for_inference(model)
import json
TOOLS = json.load(open("ndp_tools_for_chat_template.json")) # the catalog
messages = [{"role":"user","content":"Find datasets about climate."}]
text = tok.apply_chat_template(messages, tools=TOOLS, tokenize=False, add_generation_prompt=True)
inputs = tok(text, return_tensors="pt").to("cuda")
out = model.generate(
**inputs, max_new_tokens=512, do_sample=False, use_cache=False,
eos_token_id=tok.convert_tokens_to_ids("<|im_end|>"),
stop_strings=["</function>"], tokenizer=tok,
)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False))
Known limitations
- Phantom None parameters: the model often emits ALL schema parameters with
Nonevalues for the unused ones (e.g. alist_organizationscall may includedataset_name=None,search_terms=None, etc.). This is a learned artifact of seeing the full schema in the system message during training. Use a post-parser to strip parameters whose value isNone/null/empty before invoking the real MCP server. Reference parser: test_inference.py:parse_tool_call. - Looping on some queries: rarely (≈ 1/8 in our smoke test) the model loops on
<parameter>blocks without emitting</function>. The tolerant parser variant recovers args even from truncated output. Settingstop_strings=["</function>"]at generation time helps when the model does emit it. - NDP-specific only: the model has seen exactly three tools. It is not a general tool-use model — it will not generalize to other MCP catalogs.
Training data generation pipeline
NDP MCP server (3 tools)
│
├─ tool-generate-full (gpt-oss:120b) → 1879 raw examples
├─ schema-filter → 1879 (no drops)
├─ tool-curate (gpt-oss:120b) → 1712 kept @ threshold 7.0
└─ prepare_data.py → fine-tune (Unsloth + TRL)
Generator + curator: SIslamMun/Generator.
Files in this repo
| file | purpose |
|---|---|
model.safetensors |
fp16 merged weights (~7.5 GB) — load with transformers |
tokenizer.json + tokenizer_config.json + chat_template.jinja |
tokenizer + Nemotron tool-aware chat template |
modeling_nemotron_h.py + configuration_nemotron_h.py |
dynamic remote code (required by trust_remote_code=True) |
*.gguf (if uploaded) |
GGUF quantizations for llama.cpp / Ollama / LMStudio |
License
Inherits the NVIDIA Open Model License of the base model.
- Downloads last month
- 153
Model tree for shazzadulimun/NDP-Nemotron-3-Nano-4B-tool-calling
Base model
nvidia/NVIDIA-Nemotron-Nano-12B-v2-Base