Use OCR v2 NIM in Helm chart#2239
Conversation
Greptile SummaryThis PR upgrades the default OCR NIM in the NeMo Retriever Helm chart from
|
| Filename | Overview |
|---|---|
| nemo_retriever/helm/values.yaml | Updates OCR NIM defaults (nimServiceName, repository, tag) from v1→v2 and flips pruneRetiredNimResources to remove stale v1 CRs — all changes are consistent and correct. |
| nemo_retriever/helm/templates/nims/nemotron-ocr-v2.yaml | Renamed from nemotron-ocr-v1.yaml; only the default nimServiceName fallback changed from 'nemotron-ocr-v1' to 'nemotron-ocr-v2'. Template logic unchanged. |
| nemo_retriever/src/nemo_retriever/harness/helm_manager.py | NIM_OPERATOR_RESOURCES tuple updated to reference 'nemotron-ocr-v2' — one-line change, consistent with the rest of the PR. |
| nemo_retriever/tests/test_helm_nimcache_model_profile.py | Adds test_default_render_uses_ocr_v2_nim asserting NIMCache/NIMService name, image, tag, and configmap URL; updates spot-check reference from 'nemotron-ocr-v1' to 'nemotron-ocr-v2'. |
| nemo_retriever/tests/test_helm_nimservice_resources.py | Template filename reference updated from 'nemotron-ocr-v1.yaml' to 'nemotron-ocr-v2.yaml' — correct one-line change. |
| docs/docs/extraction/prerequisites-support-matrix.md | Updates OCR NIM references from v1→v2 throughout; also fixes the Helm README anchor link from the versioned branch (26.05) to main. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[helm install / upgrade] --> B{nimOperator.ocr.enabled?}
B -- false --> C[Skip OCR NIM]
B -- true --> D[Render nemotron-ocr-v2.yaml]
D --> E[NIMCache: nemotron-ocr-v2\nnvcr.io/nim/nvidia/nemotron-ocr-v2:1.4.0]
D --> F[NIMService: nemotron-ocr-v2]
E --> G[ConfigMap auto-wires\nocr_invoke_url: http://nemotron-ocr-v2:8000/v1/infer]
F --> G
A --> H[deploy.sh post-reconcile\npruneRetiredNimResources]
H --> I[Delete NIMCache nemotron-ocr-v1\nDelete NIMService nemotron-ocr-v1]
style E fill:#c8f7c5
style F fill:#c8f7c5
style I fill:#f7c5c5
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[helm install / upgrade] --> B{nimOperator.ocr.enabled?}
B -- false --> C[Skip OCR NIM]
B -- true --> D[Render nemotron-ocr-v2.yaml]
D --> E[NIMCache: nemotron-ocr-v2\nnvcr.io/nim/nvidia/nemotron-ocr-v2:1.4.0]
D --> F[NIMService: nemotron-ocr-v2]
E --> G[ConfigMap auto-wires\nocr_invoke_url: http://nemotron-ocr-v2:8000/v1/infer]
F --> G
A --> H[deploy.sh post-reconcile\npruneRetiredNimResources]
H --> I[Delete NIMCache nemotron-ocr-v1\nDelete NIMService nemotron-ocr-v1]
style E fill:#c8f7c5
style F fill:#c8f7c5
style I fill:#f7c5c5
Reviews (2): Last reviewed commit: "Use OCR v2 NIM in Helm chart" | Re-trigger Greptile
| if doc.get("kind") == "NIMCache" | ||
| and doc.get("metadata", {}).get("name") == "nemotron-ocr-v2" | ||
| ) | ||
| self.assertEqual( | ||
| ocr_cache["spec"]["source"]["ngc"]["modelPuller"], | ||
| "nvcr.io/nim/nvidia/nemotron-ocr-v2:1.4.0", | ||
| ) | ||
|
|
||
| ocr_service = next( | ||
| doc | ||
| for doc in docs | ||
| if doc.get("kind") == "NIMService" | ||
| and doc.get("metadata", {}).get("name") == "nemotron-ocr-v2" | ||
| ) |
There was a problem hiding this comment.
Unguarded
next() yields opaque StopIteration on test failure
Both next(doc for doc in docs if ...) calls have no default argument. If the rendered manifest does not contain a NIMCache or NIMService named nemotron-ocr-v2 — for example after a future rename or if the OCR NIM is inadvertently disabled — Python propagates StopIteration to the test runner, which reports it as an error rather than a failure. The resulting message ("StopIteration") gives no indication of which document was missing or why. Passing next(..., None) and asserting assertIsNotNone would produce a clear assertion message instead.
Prompt To Fix With AI
This is a comment left during a code review.
Path: nemo_retriever/tests/test_helm_nimcache_model_profile.py
Line: 247-260
Comment:
**Unguarded `next()` yields opaque `StopIteration` on test failure**
Both `next(doc for doc in docs if ...)` calls have no default argument. If the rendered manifest does not contain a `NIMCache` or `NIMService` named `nemotron-ocr-v2` — for example after a future rename or if the OCR NIM is inadvertently disabled — Python propagates `StopIteration` to the test runner, which reports it as an *error* rather than a *failure*. The resulting message ("StopIteration") gives no indication of which document was missing or why. Passing `next(..., None)` and asserting `assertIsNotNone` would produce a clear assertion message instead.
How can I resolve this? If you propose a fix, please make it concise.221fb44 to
1a3745c
Compare
Description
Update the NeMo Retriever Helm chart to deploy the Nemotron OCR v2 NIM by default instead of OCR v1. This changes the OCR NIMService/NIMCache name, image repository, and image tag to
nvcr.io/nim/nvidia/nemotron-ocr-v2:1.4.0, flips retired-resource pruning to clean up the old v1 service, and keeps the auto-wired service config pointed at the active OCR NIM.The PR also updates Helm docs, extraction docs, the harness NIM wait-list, and Helm regression tests so rendered manifests assert the v2 NIM image and endpoint.
Validation performed:
helm template nrl-ocr-v2 nemo_retriever/helm --set ngcImagePullSecret.create=false --set ngcApiSecret.create=false --set nimOperator.rerankqa.enabled=true --set nimOperator.audio.enabled=true --set nimOperator.nemotron_parse.enabled=true --set nimOperator.nemotron_3_nano_omni_30b_a3b_reasoning.enabled=true --api-versions apps.nvidia.com/v1alpha1.venv/bin/pytest nemo_retriever/tests/test_helm_nimcache_model_profile.py nemo_retriever/tests/test_helm_nimservice_resources.pydocker pull nvcr.io/nim/nvidia/nemotron-ocr-v2:1.4.0docker run --rm --gpus '"device=0"' nvcr.io/nim/nvidia/nemotron-ocr-v2:1.4.0 list-model-profilesChecklist