Instructions to use nvidia/NVIDIA-Nemotron-Nano-12B-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/NVIDIA-Nemotron-Nano-12B-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nvidia/NVIDIA-Nemotron-Nano-12B-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("nvidia/NVIDIA-Nemotron-Nano-12B-v2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nvidia/NVIDIA-Nemotron-Nano-12B-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nvidia/NVIDIA-Nemotron-Nano-12B-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/NVIDIA-Nemotron-Nano-12B-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nvidia/NVIDIA-Nemotron-Nano-12B-v2
- SGLang
How to use nvidia/NVIDIA-Nemotron-Nano-12B-v2 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 "nvidia/NVIDIA-Nemotron-Nano-12B-v2" \ --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": "nvidia/NVIDIA-Nemotron-Nano-12B-v2", "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 "nvidia/NVIDIA-Nemotron-Nano-12B-v2" \ --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": "nvidia/NVIDIA-Nemotron-Nano-12B-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use nvidia/NVIDIA-Nemotron-Nano-12B-v2 with Docker Model Runner:
docker model run hf.co/nvidia/NVIDIA-Nemotron-Nano-12B-v2
Commit History
-
Fixing nested JSON args parsing for tool-calls in streaming (#5)
Verified signature- Fixing nested JSON args parsing for tool-calls in streaming (f6befffb88a3db7fc34575f7d6ce7bec95c2cdbc) Co-authored-by: Ameya Sunil Mahabaleshwarkar <ameyasunilm@users.noreply.huggingface.co>f428df0
-
Updating streaming tool-call parser to return ChoiceDeltaToolCall (#4)
Verified signature- Updating streaming tool-call parser to return ChoiceDeltaToolCall (6295cc55c4d768b97137f2918c1218cb6c992fc0) Co-authored-by: Ameya Sunil Mahabaleshwarkar <ameyasunilm@users.noreply.huggingface.co>a4b5703
-
Adding streaming tool call parser (#3)
Verified signature- Adding streaming tool call parser (c8bfb1c0aff2f38dc2ea19182ffb693e04afb492) Co-authored-by: Ameya Sunil Mahabaleshwarkar <ameyasunilm@users.noreply.huggingface.co>977c88b
-
Update modeling_nemotron_h.py
Verified signature08bd10c
-
Update README.md
Verified signaturee539bfb
-
Update README.md
Verified signatured7af239
-
Update README.md
Verified signaturef6ed05d
-
Update README.md
Verified signaturebb43b98
-
Upload acc-vs-budget.png
Verified signaturef74a2fe -
Update README.md
Verified signature7e158c1 -
Update README.md
Verified signatureca3a620 -
Update README.md
Verified signature988e562 -
Upload 4 files
Verified signaturee0f634f -
Update README.md
Verified signature582343a -
Create README.md
Verified signature368c483
-
Update tokenizer_config.json
Verified signature6cf81f6 -
Upload modeling_nemotron_h.py
Verified signaturec554725 -
Upload modeling_nemotron_h.py
Verified signatureea1e856 -
Upload folder using huggingface_hub
Verified signature91f6915 -
initial commit
Verified signatureac4d013