Downloads · 30 days
16
15% of all-time downloads
cernis-intelligence/cernis-legal-ocr
cernis-legal-ocr is a machine learning model from cernis-intelligence. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
A specialized vision-language model fine-tuned for legal document OCR, built on Qwen2.5-VL-7B-Instruct.
Downloads · 30 days
16
15% of all-time downloads
All-time downloads
110
Public
Parameters
8.3B
16.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors16.8 GB · 100%
From the Hugging Face model README
A specialized vision-language model fine-tuned for legal document OCR, built on Qwen2.5-VL-7B-Instruct.
Cernis-Legal-OCR is a LoRA fine-tuned version of Qwen2.5-VL-7B-Instruct, specifically optimized for extracting text from legal documents including court filings, case law, contracts, and other legal materials. The model was trained on 5,000 synthetic legal documents generated from the Caselaw Access Project dataset.
Key Features:
This model is designed for:
from unsloth import FastVisionModel
from transformers import AutoTokenizer
from PIL import Image
# Load model and tokenizer
model, tokenizer = FastVisionModel.from_pretrained(
"coolAI/cernis-legal-ocr",
load_in_4bit=True,
)
FastVisionModel.for_inference(model)
# Prepare input
image = Image.open("legal_document.png")
messages = [{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": "Extract all text from this legal document."}
]
}]
# Generate
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=True, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=2048, temperature=0.7)
text = tokenizer.decode(outputs[0], skip_special_tokens=True)
The model was trained on synthetic legal documents generated from the Caselaw Access Project dataset. Documents were rendered with realistic legal formatting and augmented with scan artifacts, photocopying effects, stamps, and margin notes to simulate real-world OCR conditions.
If you use this model, please cite:
@misc{cernis-legal-ocr,
title={Cernis-Legal-OCR: A Specialized Vision Model for Legal Document Processing},
author={Cernis AI},
year={2025},
howpublished={\url{https://huggingface.co/coolAI/cernis-legal-ocr}}
}
Built using Unsloth for efficient fine-tuning and trained on data from the Caselaw Access Project.