Image-Text-to-Text
Transformers
Safetensors
English
qwen2_5_vl
OCR
pdf2markdown
conversational
Eval Results
text-generation-inference
Instructions to use nanonets/Nanonets-OCR-s with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nanonets/Nanonets-OCR-s with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="nanonets/Nanonets-OCR-s") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("nanonets/Nanonets-OCR-s") model = AutoModelForMultimodalLM.from_pretrained("nanonets/Nanonets-OCR-s", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nanonets/Nanonets-OCR-s with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nanonets/Nanonets-OCR-s" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nanonets/Nanonets-OCR-s", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/nanonets/Nanonets-OCR-s
- SGLang
How to use nanonets/Nanonets-OCR-s with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "nanonets/Nanonets-OCR-s" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nanonets/Nanonets-OCR-s", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "nanonets/Nanonets-OCR-s" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nanonets/Nanonets-OCR-s", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use nanonets/Nanonets-OCR-s with Docker Model Runner:
docker model run hf.co/nanonets/Nanonets-OCR-s
Add Real5-OmniDocBench evaluation results for Nanonets-OCR-s
#41
by changdazhou - opened
.eval_results/real5_omnidocbench.yaml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
- dataset:
|
| 2 |
+
id: PaddlePaddle/Real5-OmniDocBench
|
| 3 |
+
task_id: overall
|
| 4 |
+
value: 84.19
|
| 5 |
+
source:
|
| 6 |
+
url: https://paddle-model-ecology.bj.bcebos.com/PPOCRVL/AIStudio/real5_omnidocbench/leaderboard_data.json
|
| 7 |
+
name: Real5-OmniDocBench leaderboard data
|
| 8 |
+
user: PaddlePaddle
|
| 9 |
+
notes: Nanonets-OCR-s; official Real5-OmniDocBench result
|
| 10 |
+
- dataset:
|
| 11 |
+
id: PaddlePaddle/Real5-OmniDocBench
|
| 12 |
+
task_id: scanning
|
| 13 |
+
value: 85.52
|
| 14 |
+
source:
|
| 15 |
+
url: https://paddle-model-ecology.bj.bcebos.com/PPOCRVL/AIStudio/real5_omnidocbench/leaderboard_data.json
|
| 16 |
+
name: Real5-OmniDocBench leaderboard data
|
| 17 |
+
user: PaddlePaddle
|
| 18 |
+
notes: Nanonets-OCR-s; official Real5-OmniDocBench result
|
| 19 |
+
- dataset:
|
| 20 |
+
id: PaddlePaddle/Real5-OmniDocBench
|
| 21 |
+
task_id: warping
|
| 22 |
+
value: 83.56
|
| 23 |
+
source:
|
| 24 |
+
url: https://paddle-model-ecology.bj.bcebos.com/PPOCRVL/AIStudio/real5_omnidocbench/leaderboard_data.json
|
| 25 |
+
name: Real5-OmniDocBench leaderboard data
|
| 26 |
+
user: PaddlePaddle
|
| 27 |
+
notes: Nanonets-OCR-s; official Real5-OmniDocBench result
|
| 28 |
+
- dataset:
|
| 29 |
+
id: PaddlePaddle/Real5-OmniDocBench
|
| 30 |
+
task_id: screen_photography
|
| 31 |
+
value: 84.86
|
| 32 |
+
source:
|
| 33 |
+
url: https://paddle-model-ecology.bj.bcebos.com/PPOCRVL/AIStudio/real5_omnidocbench/leaderboard_data.json
|
| 34 |
+
name: Real5-OmniDocBench leaderboard data
|
| 35 |
+
user: PaddlePaddle
|
| 36 |
+
notes: Nanonets-OCR-s; official Real5-OmniDocBench result
|
| 37 |
+
- dataset:
|
| 38 |
+
id: PaddlePaddle/Real5-OmniDocBench
|
| 39 |
+
task_id: illumination
|
| 40 |
+
value: 85.01
|
| 41 |
+
source:
|
| 42 |
+
url: https://paddle-model-ecology.bj.bcebos.com/PPOCRVL/AIStudio/real5_omnidocbench/leaderboard_data.json
|
| 43 |
+
name: Real5-OmniDocBench leaderboard data
|
| 44 |
+
user: PaddlePaddle
|
| 45 |
+
notes: Nanonets-OCR-s; official Real5-OmniDocBench result
|
| 46 |
+
- dataset:
|
| 47 |
+
id: PaddlePaddle/Real5-OmniDocBench
|
| 48 |
+
task_id: skew
|
| 49 |
+
value: 81.98
|
| 50 |
+
source:
|
| 51 |
+
url: https://paddle-model-ecology.bj.bcebos.com/PPOCRVL/AIStudio/real5_omnidocbench/leaderboard_data.json
|
| 52 |
+
name: Real5-OmniDocBench leaderboard data
|
| 53 |
+
user: PaddlePaddle
|
| 54 |
+
notes: Nanonets-OCR-s; official Real5-OmniDocBench result
|