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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("nanonets/Nanonets-OCR-s") model = AutoModelForImageTextToText.from_pretrained("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?"} ] }, ] 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
- 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 MDPBench evaluation results
#39 opened about 1 month ago
by
Delores-Lin
Question about the base model used for nanonets/Nanonets-OCR-s (relation to Qwen/Qwen2.5-VL-3B-Instruct)
#38 opened 2 months ago
by
s1ngledoge
Disappointing output
5
#37 opened 3 months ago
by
mkuzmanov
Update config.json
#36 opened 7 months ago
by
HTX-GXTEO
Prompt used for blog examples
#35 opened 8 months ago
by
TK-13
Optimizing Input for Faster Rendering with NanoNet
1
#34 opened 8 months ago
by
FastaLaPasta
How do I disable auto-correction of words?
#33 opened 9 months ago
by
cloth1975
Request to Use Vision Transformer Outputs Without LLM Correction
#32 opened 9 months ago
by
SARAH-HADDAD
Batch inference
4
#31 opened 9 months ago
by
linhng0101
RuntimeError: weight lm_head.weight does not exist error when deploying to HF inference endpoint.
#29 opened 10 months ago
by
cheeseburgerhere
Language support
#28 opened 10 months ago
by
ntmp1910
Prompts
2
#27 opened 10 months ago
by
yernarbekbolat
Bounding boxes
2
#26 opened 11 months ago
by
yumikimi381
The OCR bug returns a continuous string of zeros
2
#24 opened 11 months ago
by
LiXiaoke
any other format will support ?
#23 opened 11 months ago
by
LawesIna
Multilingual support
4
#21 opened 11 months ago
by
Fedoration
Issues with Multi-Column Text Recognition and the Need for hOCR Support
➕ 1
2
#20 opened 11 months ago
by
techana
License
➕ 1
5
#19 opened 11 months ago
by
amazingvince
vLLM compatibility issue with nanonets/Nanonets-OCR-s: Processor initialization conflict
5
#18 opened 11 months ago
by
WpythonW
stats for your leaderboard?
1
#16 opened 11 months ago
by
rawwerks
how many languages in your training data
#15 opened 11 months ago
by
xingwang1234
CUDA Out of Memory
6
#14 opened 11 months ago
by
ep5000
I love this!
4
#13 opened 11 months ago
by
Taylor-eOS
Details for dataset generation
➕ 13
#11 opened 11 months ago
by
deepcopy
returned a loop result
➕ 17
#10 opened 11 months ago
by
Arker
Possible memory leak using CPU.
#9 opened 11 months ago
by
ShinxTrevoso
Multiple-page markdown heading level consistency
1
#7 opened 11 months ago
by
ivankeller
Shadowed Checkboxes and Lines as Checks
5
#5 opened 11 months ago
by
ep5000
Colab demo and explainer video
#3 opened 11 months ago
by
ritheshSree
License Clarification
👀 1
10
#2 opened 11 months ago
by
pszemraj
Local Installation Video and Testing - Step by Step
👍 1
4
#1 opened 11 months ago
by
fahdmirzac