Text Generation
Transformers
Safetensors
English
qwen2
nvidia
math
conversational
text-generation-inference
Instructions to use nvidia/OpenMath-Nemotron-14B-Kaggle with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/OpenMath-Nemotron-14B-Kaggle with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nvidia/OpenMath-Nemotron-14B-Kaggle") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nvidia/OpenMath-Nemotron-14B-Kaggle") model = AutoModelForCausalLM.from_pretrained("nvidia/OpenMath-Nemotron-14B-Kaggle") 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nvidia/OpenMath-Nemotron-14B-Kaggle with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nvidia/OpenMath-Nemotron-14B-Kaggle" # 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/OpenMath-Nemotron-14B-Kaggle", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nvidia/OpenMath-Nemotron-14B-Kaggle
- SGLang
How to use nvidia/OpenMath-Nemotron-14B-Kaggle 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/OpenMath-Nemotron-14B-Kaggle" \ --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/OpenMath-Nemotron-14B-Kaggle", "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/OpenMath-Nemotron-14B-Kaggle" \ --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/OpenMath-Nemotron-14B-Kaggle", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use nvidia/OpenMath-Nemotron-14B-Kaggle with Docker Model Runner:
docker model run hf.co/nvidia/OpenMath-Nemotron-14B-Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -61,45 +61,13 @@ The pipeline we used to produce the data and models is fully open-sourced!
|
|
| 61 |
We provide [all instructions](https://nvidia.github.io/NeMo-Skills/openmathreasoning1/)
|
| 62 |
to fully reproduce our results, including data generation.
|
| 63 |
|
| 64 |
-
# How to use the models?
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
To run inference with CoT mode, you can use this example code snippet.
|
| 69 |
-
|
| 70 |
-
```python
|
| 71 |
-
import transformers
|
| 72 |
-
import torch
|
| 73 |
-
|
| 74 |
-
model_id = "nvidia/OpenMath-Nemotron-14B-Kaggle"
|
| 75 |
-
|
| 76 |
-
pipeline = transformers.pipeline(
|
| 77 |
-
"text-generation",
|
| 78 |
-
model=model_id,
|
| 79 |
-
model_kwargs={"torch_dtype": torch.bfloat16},
|
| 80 |
-
device_map="auto",
|
| 81 |
-
)
|
| 82 |
-
|
| 83 |
-
messages = [
|
| 84 |
-
{
|
| 85 |
-
"role": "user",
|
| 86 |
-
"content": "Solve the following math problem. Make sure to put the answer (and only answer) inside \\boxed{}.\n\n" +
|
| 87 |
-
"What is the minimum value of $a^2+6a-7$?"},
|
| 88 |
-
]
|
| 89 |
-
|
| 90 |
-
outputs = pipeline(
|
| 91 |
-
messages,
|
| 92 |
-
max_new_tokens=4096,
|
| 93 |
-
)
|
| 94 |
-
print(outputs[0]["generated_text"][-1]['content'])
|
| 95 |
-
```
|
| 96 |
-
|
| 97 |
-
To run inference with TIR or GenSelect modes, we highly recommend to use our
|
| 98 |
[reference implementation in NeMo-Skills](https://nvidia.github.io/NeMo-Skills/openmathreasoning1/evaluation/).
|
| 99 |
|
| 100 |
Please note that these models have not been instruction tuned on general data and thus might not provide good answers outside of math domain.
|
| 101 |
|
| 102 |
-
|
| 103 |
## Citation
|
| 104 |
|
| 105 |
If you find our work useful, please consider citing us!
|
|
@@ -134,7 +102,7 @@ This model is intended to facilitate research in the area of mathematical reason
|
|
| 134 |
|
| 135 |
Huggingface 04/23/2025 <br>
|
| 136 |
|
| 137 |
-
## Model Architecture: <br>
|
| 138 |
|
| 139 |
**Architecture Type:** Transformer decoder-only language model <br>
|
| 140 |
|
|
@@ -145,7 +113,7 @@ Huggingface 04/23/2025 <br>
|
|
| 145 |
|
| 146 |
** This model has 1.5B of model parameters. <br>
|
| 147 |
|
| 148 |
-
## Input: <br>
|
| 149 |
|
| 150 |
**Input Type(s):** Text <br>
|
| 151 |
|
|
@@ -157,7 +125,7 @@ Huggingface 04/23/2025 <br>
|
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
-
## Output: <br>
|
| 161 |
|
| 162 |
**Output Type(s):** Text <br>
|
| 163 |
|
|
@@ -173,7 +141,7 @@ Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated sys
|
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
-
## Software Integration : <br>
|
| 177 |
|
| 178 |
**Runtime Engine(s):** <br>
|
| 179 |
|
|
@@ -195,7 +163,7 @@ Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated sys
|
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
-
## Model Version(s):
|
| 199 |
|
| 200 |
[OpenMath-Nemotron-1.5B](https://huggingface.co/nvidia/OpenMath-Nemotron-1.5B)
|
| 201 |
|
|
|
|
| 61 |
We provide [all instructions](https://nvidia.github.io/NeMo-Skills/openmathreasoning1/)
|
| 62 |
to fully reproduce our results, including data generation.
|
| 63 |
|
| 64 |
+
## How to use the models?
|
| 65 |
|
| 66 |
+
This model will always use code execution to solve math problems, so we highly recommend to run inference with our
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
[reference implementation in NeMo-Skills](https://nvidia.github.io/NeMo-Skills/openmathreasoning1/evaluation/).
|
| 68 |
|
| 69 |
Please note that these models have not been instruction tuned on general data and thus might not provide good answers outside of math domain.
|
| 70 |
|
|
|
|
| 71 |
## Citation
|
| 72 |
|
| 73 |
If you find our work useful, please consider citing us!
|
|
|
|
| 102 |
|
| 103 |
Huggingface 04/23/2025 <br>
|
| 104 |
|
| 105 |
+
### Model Architecture: <br>
|
| 106 |
|
| 107 |
**Architecture Type:** Transformer decoder-only language model <br>
|
| 108 |
|
|
|
|
| 113 |
|
| 114 |
** This model has 1.5B of model parameters. <br>
|
| 115 |
|
| 116 |
+
### Input: <br>
|
| 117 |
|
| 118 |
**Input Type(s):** Text <br>
|
| 119 |
|
|
|
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
+
### Output: <br>
|
| 129 |
|
| 130 |
**Output Type(s):** Text <br>
|
| 131 |
|
|
|
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
+
### Software Integration : <br>
|
| 145 |
|
| 146 |
**Runtime Engine(s):** <br>
|
| 147 |
|
|
|
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
+
### Model Version(s):
|
| 167 |
|
| 168 |
[OpenMath-Nemotron-1.5B](https://huggingface.co/nvidia/OpenMath-Nemotron-1.5B)
|
| 169 |
|