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
chest_xray_image_or_fixture; outputs areresult_json.
Instructions
- Read
skill_manifest.yamlbefore changing arguments, side effects, or validation gates. - Run
scripts/run_nv_reason_cxr.pythrough the documented command below; pass--out-dironly for generated fixtures or harness-managed artifact directories. - If a host agent exposes
run_script, userun_script("scripts/run_nv_reason_cxr.py", args=[...]); otherwise run the Bash/Python command shown below. - Check the emitted JSON and paired verifier guidance before treating the run as evidence.
- When reporting a completed run, return the full wrapper JSON or at minimum
the complete output.response_text exactly as emitted, including any
model-generated <think>...</think> and <answer>...</answer> sections. Do
not collapse the result to labels unless the user explicitly asks for a
summary.
Available Scripts
| Script | Purpose | Arguments |
|---|---|---|
| scripts/run_nv_reason_cxr.py | Primary entrypoint declared by skill_manifest.yaml. | PATH_TO_CXR_OR_FIXTURE [--out-dir OUT_DIR] [--backend local\|hf-space-api] [--mock] [--check-setup] |
Prerequisites
- Local backend requirements: GPU/CUDA when declared by the manifest; Python packages listed in
runtime.side_effects.pip_packages. - API backend requirements: public network access to the Hugging Face Space; no local PyTorch, Transformers, CUDA, model cache, or Hugging Face token.
- Side effects: emits result JSON on stdout; may write generated fixture artifacts under the caller's
--out-dir; may cache model assets under~/.cache/huggingface/for local inference; and may contacthttps://huggingface.co,https://github.com, orhttps://*.hf.spaceoutside--mockmode. - 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.
- The
hf-space-apibackend depends on public Hugging Face Space availability and API compatibility. - Not for clinical deployment, clinical interpretation, autonomous diagnosis, treatment decisions.
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
| Missing dependency or import error | Runtime package drift from skill_manifest.yaml. | Install the packages declared in the manifest or use the documented setup command. |
| CUDA unavailable from an agent but available in a user terminal | The agent sandbox, container, or job wrapper may not expose NVIDIA device nodes even when the same Python environment has CUDA-capable PyTorch installed. | Compare python -c "import torch; print(torch.cuda.is_available())" and nvidia-smi inside the agent context and in the user terminal. If only the agent context fails, rerun with GPU/device access, use the host terminal, or pass --device cpu --allow-cpu only for an explicit slow CPU test. |
| API backend HTTP or schema error | The public Hugging Face Space may be unavailable, rate limited, or changed. | Re-run later or use --backend local when local dependencies and CUDA are available. |
| 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. |