Skip to content
Back to skills

Unlimited Ocr

ASecurity

Parse long documents using Baidu Unlimited-OCR in one shot. Use this skill when dealing with multi-page documents that need OCR processing.

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
ai-agentspythonrustshellgit

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 2 files and shows the line behind each finding

Scanned November 11, 2026

npx -y skills add siddu1004/SFP --skill unlimited-ocr --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Unlimited Ocr?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Unlimited Ocr
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/siddu1004-unlimited-ocr/badge)](https://www.skillsdirectory.com/skills/siddu1004-unlimited-ocr)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: unlimited-ocr
description: "Parse long documents using Baidu Unlimited-OCR in one shot. Use this skill when dealing with multi-page documents that need OCR processing."
---

> Written for SFP in its own words from the project at https://github.com/baidu/Unlimited-OCR (upstream license: MIT).

# Parsing Long Documents with Baidu Unlimited-OCR

## Use this skill when
- You have a document with multiple pages that require OCR.
- You want to process the entire document in one request, leveraging cross-page context.

## What it is
Baidu Unlimited-OCR is an advanced OCR model capable of parsing ultra-long documents. It uses Sparse Reference Sliding Window Attention (SR-SWA) to handle large volumes of text efficiently, ensuring fast and accurate results without quadratic attention scaling or memory bottlenecks.

## Steps
1. **Install Required Packages**: Ensure you have the necessary Python packages installed.
   ```shell
   pip install torch==2.13.0 torchvision pillow transformers==4.52.1 huggingface-hub==0.36.0 \
     tokenizers==0.21.4 addict==2.4.0 einops==0.8.2 easydict==1.13
   ```
2. **Load the Model**: Import and load the Baidu Unlimited-OCR model.
   ```python
   import torch
   from transformers import AutoModel, AutoTokenizer

   model_name = "baidu/Unlimited-OCR-2"
   tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
   model = AutoModel.from_pretrained(model_name, trust_remote_code=True, use_safetensors=True,
                                     torch_dtype=torch.bfloat16).eval().cuda()
   ```
3. **Perform Multi-page Inference**: Use the `infer_multi` method to parse all pages of a document in one request.
   ```python
   pages = [f"your_doc/page_{i}.jpg" for i in range(1, 8)]
   text, num_tokens = model.infer_multi(tokenizer, image_files=pages,
                                        output_path="output/multi", save_results=True)
   ```
4. **Save or Process the Output**: The parsed text is returned and can be saved or further processed as needed.

## Checks
- Ensure all required packages are installed.
- Verify that the model loads correctly without errors.
- Confirm that the document pages are in the correct order before passing them to the inference method.

## Pitfalls
- **Memory Usage**: Although SR-SWA helps manage memory, ensure your system has sufficient resources for large documents.
- **Image Quality**: High-quality images yield better OCR results. Preprocess images if necessary to improve accuracy.
- **Error Handling**: Implement error handling for cases where the model fails to load or inference fails.

Files in this skill

  • LICENSE88 B
  • SKILL.md2.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.