OpenCodeReasoning-Nemotron-7B is a large language model (LLM) which is a derivative of Qwen2.5-7B-Instruct (AKA the reference model). It is a reasoning model that is post-trained for reasoning for code generation. The model supports a context length of 32K tokens.
This model is ready for commercial/non-commercial use.
import transformers
import torch
model_id = "nvidia/OpenCodeReasoning-Nemotron-7B"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
prompt = """You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
{user}
"""
messages = [
{
"role": "user",
"content": prompt.format(user="Write a program to calculate the sum of the first $N$ fibonacci numbers")},
]
outputs = pipeline(
messages,
max_new_tokens=32768,
)
print(outputs[0]["generated_text"][-1]['content'])
Architecture Type: Dense decoder-only Transformer model Network Architecture: Qwen-7B-Instruct
This model was developed based on Qwen2.5-7B-Instruct and has 7B model parameters. OpenCodeReasoning-Nemotron-7B was developed based on Qwen2.5-7B-Instruct and has 7B model parameters.
Other Properties Related to Output: Context length up to 32,768 tokens
Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated systems. By leveraging NVIDIA’s hardware (e.g. GPU cores) and software frameworks (e.g., CUDA libraries), the model achieves faster training and inference times compared to CPU-only solutions.
The training corpus for OpenCodeReasoning-Nemotron-7B is OpenCodeReasoning dataset, which is composed of competitive programming questions and DeepSeek-R1 generated responses.
Data Collection Method: Hybrid: Automated, Human, Synthetic
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
Please report security vulnerabilities or NVIDIA AI Concerns here.
Files
15 files · 15.2 GBWeights 15.2 GB (safetensors). Sizes and sha256 from the signed manifest.
import os
os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com"
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("nvidia/OpenCodeReasoning-Nemotron-7B", revision="3baa2a3d73bbca12483ad19fef7babdcb2222987")
model = AutoModelForCausalLM.from_pretrained("nvidia/OpenCodeReasoning-Nemotron-7B", revision="3baa2a3d73bbca12483ad19fef7babdcb2222987", device_map="auto")