Fix nemotron_parse: disable KV cache and suppress pdfium text#1746
Open
randerzander wants to merge 4 commits intoNVIDIA:mainfrom
Open
Fix nemotron_parse: disable KV cache and suppress pdfium text#1746randerzander wants to merge 4 commits intoNVIDIA:mainfrom
randerzander wants to merge 4 commits intoNVIDIA:mainfrom
Conversation
…patibility The installed transformers version uses DynamicCache objects for past_key_values, but the custom MBart decoder code in hf_nemotron_parse_modeling.py passes raw tuples, causing AttributeError crashes during generation. Passing use_cache=False bypasses the KV cache entirely and unblocks inference. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When text_extraction_method is "nemotron_parse", mark the page as needing OCR so pdfium-extracted text is not included alongside the nemotron_parse output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove <x_...>, <y_...>, <class_...> spatial annotation tags and convert
\begin{tabular}...\end{tabular} blocks to pipe-delimited markdown tables.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace post-hoc tag removal with a structured parser that iterates detection spans (<x><y>CONTENT<x><y><class_LABEL>), extracting only the content text and skipping Picture entries. LaTeX tables are still converted to pipe-delimited markdown. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously nemotron-parse inference wasn't actually happening (transformers version incompatibility), but fallback logic hid the failure by using pdfium extracted text instead.
This PR fixes severail things:
Claude description:
NemotronParseV12.invoke(use_cache=False) to fixAttributeError: 'tuple' object has no attribute 'update'with newer transformers versions that useDynamicCacheobjectstext_extraction_method="nemotron_parse"so pdfium text is not duplicated alongside nemotron_parse output