This is an
unofficial fork
of
nvidia/NVIDIA-Nemotron-Parse-v1.2
with updated modeling code and documentation only.
Model weights are identical to the official release.
The custom code (
hf_nemotron_parse_modeling.py
, etc.) has been updated to work with
transformers>=4.57
(DynamicCache API changes). For the official model, license details, and support, refer to the
original NVIDIA repository
.
Description
NVIDIA Nemotron Parse v1.2 is designed to understand document semantics and extract text and tables elements with spatial grounding. Given an image, NVIDIA Nemotron Parse v1.2 produces structured annotations, including formatted text, bounding-boxes and the corresponding semantic classes, ordered according to the document's reading flow. It overcomes the shortcomings of traditional OCR technologies that struggle with complex document layouts with structural variability, and helps transform unstructured documents into actionable and machine-usable representations. This has several downstream benefits such as increasing the availability of training-data for Large Language Models (LLMs), improving the accuracy of extractor, curator, retriever and AI agentic applications, and enhancing document understanding pipelines.
import torch
from PIL import Image
from transformers import AutoModel, AutoProcessor, AutoTokenizer, GenerationConfig
# Load model and processor
model_path = "BEE-spoke-data/NVIDIA-Nemotron-Parse-v1.2"# Or use a local path
model = AutoModel.from_pretrained(
model_path,
trust_remote_code=True,
device_map="auto",
dtype=torch.bfloat16,
).eval()
tokenizer = AutoTokenizer.from_pretrained(model_path)
processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True)
# Load image
image = Image.open("path/to/your/image.jpg")
task_prompt = "</s><s><predict_bbox><predict_classes><output_markdown><predict_no_text_in_pic>"# task_prompt = "</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>"# Process image
inputs = processor(images=[image], text=task_prompt, return_tensors="pt", add_special_tokens=False).to(model.device)
generation_config = GenerationConfig.from_pretrained(model_path, trust_remote_code=True)
# Generate text
outputs = model.generate(**inputs, generation_config=generation_config)
# Decode the generated text
generated_text = processor.batch_decode(outputs, skip_special_tokens=True)[0]
Accelerator support:
The HuggingFace code path works on any device supported by
device_map="auto"
— NVIDIA GPUs (CUDA), Apple Silicon (MPS), and CPU. vLLM requires CUDA.
Postprocessing
Post-processing is available directly via the processor — no extra imports needed:
from PIL import ImageDraw
# Full pipeline: parse output, map bboxes to original image coords, clean text
results = processor.post_process_generation(
generated_text,
image_size=(image.width, image.height), # optional, for pixel-coord bboxes
text_format="markdown", # markdown | plain
table_format="latex", # latex | HTML | markdown
)
for elem in results:
print(elem["class"], ":", elem["text"])
# Draw bounding boxes on the original image
draw = ImageDraw.Draw(image)
for elem in results:
draw.rectangle(elem["bbox_original"], outline="red")
Each element in
results
is a dict with keys
"class"
,
"bbox"
(normalised),
"text"
(post-processed), and
"bbox_original"
(pixel coordinates, present when
image_size
is provided).
The individual building blocks are also available as static methods if needed:
Note:
we recommend using the default prompt that extracts bounding boxes, classes, and text in markdown formatting for all use cases (
</s><s><predict_bbox><predict_classes><output_markdown><predict_no_text_in_pic>
or
</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>
). If necessary, optionally the prompt that omits text extraction and only outputs bounding boxes and classes could be used:
</s><s><predict_bbox><predict_classes><output_no_text><predict_no_text_in_pic>
.
Logits processors
With Nemotron-Parse-v1.2 we share 2 logits processors available in logitsprocessors/ dir for vllm and in hf_logits_processor.py for the python model.
NemotronParseRepetitionStopProcessor - when used during generation, detects repeating n-grams and forces the model to close the block when detecting potential hallucination.
NemotronParseTableInsertionLogitsProcessor - forces every block to follow a table structure (useful if, e.g., you are running the model on table image crops)
Please refer to the example_with_processor.py for example usage with python model. With vllm, you can provide these as arguments to vllm serve, after exporting logitsprocs/ to PYTHONPATH, e.g.:
Model card details (architecture, training data, ethical considerations)
Deployment Geography
Global
Use Case
NVIDIA Nemotron Parse v1.2 will be capable of comprehensive text understanding and document structure understanding. It will be used in retriever and curator solutions. Its text extraction datasets and capabilities will help with LLM and VLM training, as well as improve run-time inference accuracy of VLMs. The NVIDIA Nemotron Parse v1.2 model will perform text extraction from PDF and PPT documents. The NVIDIA Nemotron Parse v1.2 can classify the objects (title, section, caption, index, footnote, lists, tables, bibliography, image) in a given document, and provide bounding boxes with coordinates.
Other Properties Related to Output: Nemotron-parse output format is a string which encodes text content (formatted or not) as well as bounding boxes and class attributes.
Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated systems. By leveraging NVIDIA's hardware (e.g. GPU cores) and software frameworks (e.g., CUDA libraries), the model achieves faster training and inference times compared to CPU-only solutions.
The integration of foundation and fine-tuned models into AI systems requires additional testing using use-case-specific data to ensure safe and effective deployment. Following the V-model methodology, iterative testing and validation at both unit and system levels are essential to mitigate risks, meet technical and functional requirements, and ensure compliance with safety and ethical standards before deployment.
Model Version(s)
Nemotron Parse 1.2
Training, Testing, and Evaluation Datasets
Training Dataset
** Image Training Data Size
[1 Million to 1 Billion Images]
** Text Training Data Size
[1 Billion to 10 Trillion Tokens]
** Data Collection Method by dataset
Hybrid: Automated, Human, Synthetic
** Labeling Method by dataset
Hybrid: Automated, Human, Synthetic
Properties (Quantity, Dataset Descriptions, Sensor(s)):
The training set contains millions of image-text items, aggregated across many large document and table datasets totaling several terabytes of data. The data consists of document-page and table images paired with OCR text, bounding boxes, and layout labels, drawn from real-world sources (scientific papers, PDFs, Wikipedia pages) as well as fully synthetic tables and word/character renderings. Modalities are primarily images plus associated text and structural annotations; content spans public-domain resources, and synthetic data. Images are obtained by rendering digital documents or generating synthetic layouts, and annotations come from OCR/layout models, third-party OCR services, and human labeling.
Inference
Acceleration Engine:
Tensor(RT)-LLM, vLLM
Test Hardware:
H100
A100
Ethical Considerations
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
Please make sure you have proper rights and permissions for all input image and video content; if image or video includes people, personal health information, or intellectual property, the image or video generated will not blur or maintain proportions of image subjects included.
NVIDIA-Nemotron-Parse-v1.2 huggingface.co is an AI model on huggingface.co that provides NVIDIA-Nemotron-Parse-v1.2's model effect (), which can be used instantly with this BEE-spoke-data NVIDIA-Nemotron-Parse-v1.2 model. huggingface.co supports a free trial of the NVIDIA-Nemotron-Parse-v1.2 model, and also provides paid use of the NVIDIA-Nemotron-Parse-v1.2. Support call NVIDIA-Nemotron-Parse-v1.2 model through api, including Node.js, Python, http.
NVIDIA-Nemotron-Parse-v1.2 huggingface.co is an online trial and call api platform, which integrates NVIDIA-Nemotron-Parse-v1.2's modeling effects, including api services, and provides a free online trial of NVIDIA-Nemotron-Parse-v1.2, you can try NVIDIA-Nemotron-Parse-v1.2 online for free by clicking the link below.
BEE-spoke-data NVIDIA-Nemotron-Parse-v1.2 online free url in huggingface.co:
NVIDIA-Nemotron-Parse-v1.2 is an open source model from GitHub that offers a free installation service, and any user can find NVIDIA-Nemotron-Parse-v1.2 on GitHub to install. At the same time, huggingface.co provides the effect of NVIDIA-Nemotron-Parse-v1.2 install, users can directly use NVIDIA-Nemotron-Parse-v1.2 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
NVIDIA-Nemotron-Parse-v1.2 install url in huggingface.co: