Images / Intermediate

Ask questions about an image with NV Reason CT

Install the NV-Reason-CT Transformers runtime, load the nvidia/NV-Reason-CT model, and run deterministic 3D CT question answering on a .nii.gz volume. Then inspect the generated answer to confirm the model responded to a question about a visible detail before trusting the pipeline.

EstimatedSource checked 9/25/2026
LOCALRENTED GPU

Before you begin

Difficulty
Intermediate
Software
Python 3.11 or newer, CUDA-capable PyTorch installation, transformers, torch, nvidia/NV-Reason-CT model files
Hardware
This setup uses Transformers. The exact checkpoint format, context, and runtime overhead determine its memory need; a weight-file size alone is not a GPU recommendation.
IMAGES / TRANSFORMERSSOURCE-LINKED SETUP

Ask questions about an image with NV Reason CT, step by step.

Install the NV-Reason-CT Transformers runtime, load the nvidia/NV-Reason-CT model, and run deterministic 3D CT question answering on a .nii.gz volume. Then inspect the generated answer to confirm the model responded to a question about a visible detail before trusting the pipeline.

Choose a package Run its commands Check the result
01
BEFORE YOU BEGIN

The documented package

This setup uses the package documented for this task. Review its source and supported platforms before starting.

The publisher has not provided a complete memory target for this task. Check its hardware guidance before starting.

CURRENT SETUP

NV Reason CT · official

This setup uses Transformers. The exact checkpoint format, context, and runtime overhead determine its memory need; a weight-file size alone is not a GPU recommendation.

View weight source
02
THE WORKFLOW

Set up NV Reason CT on your machine

Pick your operating system. Every command below is for the selected package and runtime.

The publisher supplies Python code but does not specify an operating system. Linux is a practical starting environment, not a publisher-tested machine. Run the Python snippets in one session, in order.

01

Prepare Python and CUDA PyTorch

Install Python 3.11 or newer and a CUDA-capable PyTorch build so that torch.cuda is available.

02

Install NV-Reason-CT requirements

From your working directory, install the model's requirements file using the publisher's documented command. This command pulls the pinned dependencies used by the NV-Reason-CT runtime, including the Transformers build needed to load the custom image processor.

python -m pip install -r https://huggingface.co/nvidia/NV-Reason-CT/resolve/main/requirements.txt
03

Load the model and processor

Create a Python script that loads nvidia/NV-Reason-CT onto the CUDA device in bfloat16 and attaches the matching processor. The remote-code flag is required for the 3D image processor, and SDPA provides the documented attention implementation.

import torch from transformers import AutoModelForImageTextToText, AutoProcessor model_id = "nvidia/NV-Reason-CT" ct_path = "path/to/volume.nii.gz" model = AutoModelForImageTextToText.from_pretrained( model_id, trust_remote_code=True, dtype=torch.bfloat16, attn_implementation="sdpa", ).eval().to("cuda") processor = AutoProcessor.from_pretrained( model_id, trust_remote_code=True, )
04

Define deterministic generation

Define the reusable generate_response helper. It accepts a .nii.gz path, the question text, a region selector, a thinking flag, and a max token count. This matches the publisher's Quick Start so the model sees the volume as a chat message and decodes the newly generated tokens only.

def generate_response( ct_path, prompt_text, anatomy_region="chest", enable_thinking=True, max_new_tokens=2048, ): messages = [ { "role": "user", "content": [ {"type": "image"}, {"type": "text", "text": prompt_text}, ], } ] prompt = processor.apply_chat_template( messages, tokenize=False, add_generation_prompt=True, enable_thinking=enable_thinking, ) inputs = processor( text=prompt, images3d=[ct_path], anatomy_region=anatomy_region, return_tensors="pt", ).to(model.device) with torch.inference_mode(): generated_ids = model.generate( **inputs, max_new_tokens=max_new_tokens, do_sample=False, use_cache=True, ) new_tokens = generated_ids[:, inputs.input_ids.shape[1]:] return processor.batch_decode( new_tokens, skip_special_tokens=True, clean_up_tokenization_spaces=False, )[0]
05

Ask a question about a visible detail

Point ct_path at a de-identified .nii.gz CT volume, choose anatomy_region="chest", and print the answer to a question about a specific finding so the answer can later be checked against the image. The example asks for a structured chest CT report.

print(generate_response(ct_path, "Write a structured chest CT report.", anatomy_region="chest"))
06

Inspect the model's answer

Run the script and read the printed response. Compare each statement against the visible anatomy in the same .nii.gz volume you passed in. If the answer ignores or contradicts an obvious structure you can see in the volume, the vision path or the region crop is not behaving as intended for that case, so adjust the region or the question text and regenerate.

03
SUCCESS CHECK · NV Reason CT

Check the image answer

Ask about a visible detail in a local test image and compare the answer to the image yourself.

This is a source-linked setup, not a YouRunAI hardware test. Confirm your exact runtime version, package, and output before relying on it.

Back to setup steps

When it doesn’t go to plan

The script raises an out-of-memory error or cannot find a CUDA device when moving the model to .to("cuda").

Confirm torch.cuda.is_available() returns True and that your GPU is adequate for a bfloat16 3D VLM (publisher-tested hardware includes H100 and L40S). If the GPU is smaller, keep the model on CPU for a quick structural check but expect generation to be impractically slow.

The processor complains that images3d or normalize_mode is unknown, or that the custom image processor cannot be loaded.

Re-run `python -m pip install -r https://huggingface.co/nvidia/NV-Reason-CT/resolve/main/requirements.txt` in the same environment as the interpreter running the script, and keep trust_remote_code=True on both from_pretrained calls so the NV-Reason-CT custom processor and configuration are fetched.

The generated answer does not reflect any structure visible in the volume.

Inspect the crop the model actually received by loading the same ct_path with `processor.image_processor_3d.load_image(ct_path, normalize_mode=0, anatomy_region=anatomy_region)` and saving the resulting tensor as a NIfTI for review. If the anatomy heuristic has selected the wrong region, manually crop the input and pass anatomy_region=None so the processor takes a centered crop.

REFERENCE LIBRARY

Sources and files

Original instructions, model files, and compatibility notes behind this setup.

2 SOURCES

The model behind this workflow

NV Reason CT
MY HARDWARE

Will it run on your machine?

Save your machine to see a personalized rating and its reasoning.

Add my hardware

Keep exploring