nv-reason-cxr
Original:🇺🇸 English
Translated
2 scripts
Used for command-shape or live NV-Reason-CXR chest X-ray reasoning smoke tests. Not for diagnosis or clinical reporting.
3installs
Sourcenvidia/skills
Added on
NPX Install
npx skill4agent add nvidia/skills nv-reason-cxrTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →NV-Reason-CXR
Purpose
- Used for command-shape or live NV-Reason-CXR chest X-ray reasoning smoke tests. Not for diagnosis or clinical reporting.
- Use the wrapper exactly as documented; do not replace the upstream entrypoint with a handwritten implementation.
- Manifest I/O: inputs are ; outputs are
chest_xray_image_or_fixture.result_json
Instructions
- Read before changing arguments, side effects, or validation gates.
skill_manifest.yaml - Run through the documented command below; keep outputs under a caller-provided run directory.
scripts/run_nv_reason_cxr.py - If a host agent exposes , use
run_script; otherwise run the Bash/Python command shown below.run_script("scripts/run_nv_reason_cxr.py", args=[...]) - Check the emitted JSON and paired verifier guidance before treating the run as evidence.
Available Scripts
| Script | Purpose | Arguments |
|---|---|---|
| Primary entrypoint declared by skill_manifest.yaml. | |
Prerequisites
- Runtime requirements: GPU/CUDA when declared by the manifest; Python packages listed in .
runtime.side_effects.pip_packages - Side effects: writes JSON outputs under the caller's , may cache model assets under
--out-dir, and may contact~/.cache/huggingface/orhttps://huggingface.cooutsidehttps://github.commode.--mock - Run commands from the repository root unless an existing section below says otherwise.
Limitations
- This is a thin wrapper. Image preprocessing, model inference, and decoding are delegated to Hugging Face Transformers and the NV-Reason-CXR-3B model.
- Output is not a diagnosis, clinical report, treatment recommendation, or triage decision. It is engineering evidence and must be reviewed by a qualified professional before any medical use.
- The model may hallucinate findings, miss subtle abnormalities, misread support devices, or produce overconfident prose.
- The committed fixture uses a generated synthetic PNG and deterministic mock response so CI can verify wrapper behavior without downloading model weights. Mock mode is not a substitute for model inference.
- Not for clinical deployment, clinical interpretation, autonomous diagnosis, treatment decisions.
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
| Missing dependency or import error | Runtime package drift from | Install the packages declared in the manifest or use the documented setup command. |
| Empty or schema-invalid output | Wrong input path, unsupported modality, or upstream failure. | Re-run with a known fixture and inspect the wrapper JSON plus stderr. |
| Validation gate failure | Output violated a declared engineering invariant. | Keep the failed evidence pack and use the gate message to repair inputs or wrapper code. |
Runs NVIDIA-Medtech
for chest X-ray image interpretation through the documented Hugging Face
Transformers inference path. The wrapper does not reimplement the model,
image preprocessing, or decoding.
NV-Reason-CXR-3BExact Runnable Surface
For command-shape smoke tests and JSON fixtures, use this repo-root wrapper path exactly:
bash
python skills/nv-reason-cxr/scripts/run_nv_reason_cxr.py PATH_TO_CXR_OR_FIXTURE --mock --out-dir OUT_DIRFor live image inference, omit only when the user asks for live model inference. Do not invent , , , or commands for ordinary user runs.
--mockMedical AI Skills runeval_engine/run.pyinfer.pypython -m nv_reason_cxrPreconditions
Install the inference dependencies in the environment that will run the
skill:
bash
pip install torch==2.7.1 torchvision==0.22.1 transformers==4.56.1 PillowThe model weights are loaded from through
Transformers. They may download to the Hugging Face cache on first use.
Set or pass only after the
weights are already cached.
nvidia/NV-Reason-CXR-3BTRANSFORMERS_OFFLINE=1--local-files-onlyCUDA is expected for practical inference. CPU execution may work for small
tests but is slow and must be requested explicitly.
Check the local environment before downloading weights or running inference:
bash
python skills/nv-reason-cxr/scripts/run_nv_reason_cxr.py --check-setupThe setup report checks importable dependencies, CUDA visibility, Hugging Face
cache state, and the recommended next step.
Operational environment variables:
| Variable | When to use |
|---|---|
| Set to |
| Override the Hugging Face model id only for compatibility probes. |
| Point at a pre-populated Hugging Face cache. |
| Authenticate model downloads when required by the local environment. |
| Set to |
| Set to |
License
The upstream repository code is Apache-2.0. The model weights are released
under the NVIDIA OneWay Noncommercial License Agreement. Users are responsible
for complying with the model-weight terms before live inference.
Usage
From Medical AI Skills repo root:
bash
python skills/nv-reason-cxr/scripts/run_nv_reason_cxr.py PATH_TO_CXR.png \
--prompt "Find abnormalities and support devices." \
--out-dir runs/nv_reason_cxr_caseUse the wrapper script directly for agent-generated commands. Do not replace
it with unless the user explicitly asks to run the eval
harness. Do not redirect stdout with in generated commands: callers and
the eval harness read the wrapper's stdout JSON, including
, to verify the run. The direct runnable surface is:
eval_engine/run.py>output.response_textbash
python skills/nv-reason-cxr/scripts/run_nv_reason_cxr.py PATH_TO_CXR_OR_FIXTURE \
--mock \
--out-dir runs/nv_reason_cxr_casePATH_TO_CXR_OR_FIXTUREruns/.../synthetic_cxr_input.jsongenerated://synthetic_chest_xrayoutput.response_text--mock--mockFor JPEG input:
bash
python skills/nv-reason-cxr/scripts/run_nv_reason_cxr.py PATH_TO_CXR.jpg \
--prompt "Describe the chest X-ray findings." \
--out-dir runs/nv_reason_cxr_caseFlags:
- — Hugging Face model id, default
--model-id.nvidia/NV-Reason-CXR-3B - — default
--device auto|cuda|cpu, using CUDA when available.auto - — required for live CPU inference; CPU runs can be very slow.
--allow-cpu - — default
--torch-dtype auto|float16|bfloat16|float32, using bfloat16 on CUDA and float32 on CPU, matching the published BF16 model.auto - — generation cap, default 2048.
--max-new-tokens - — use only locally cached Hugging Face assets.
--local-files-only - — deterministic dry-run response for CI and wiring checks.
--mock - — optional known-good prompt presets from the model card/demo behavior.
--prompt-preset findings|comprehensive|educational|structured
The tested local live path uses:
AutoModelForImageTextToText.from_pretrained(..., dtype=torch.bfloat16).eval().to("cuda")AutoProcessor.from_pretrained(..., use_fast=True)- PNG/JPEG image input plus one text prompt
- by default
max_new_tokens=2048
The script emits JSON on stdout and writes no clinical report files. It records
input image metadata, prompt, model id, runtime mode, response text, and known
limitations. If is , rerun with a
higher value.
runtime.truncated_by_max_new_tokenstrue--max-new-tokensFixture Smoke Test
The committed fixture uses a generated synthetic PNG and mock mode so the
eval harness can verify the wrapper without downloading weights:
bash
python eval_engine/run.py skills/nv-reason-cxr \
--fixture skills/nv-reason-cxr/fixtures/synthetic_cxr_input.json \
--out runs/nv_reason_cxr_smokeLimits
This is research and engineering tooling only. It is not validated for
clinical diagnosis, treatment decisions, triage, patient-facing reporting, or
regulatory use. Model outputs can hallucinate, miss subtle findings, or
overstate uncertainty. A qualified professional must review any use in a
medical workflow.