Image-Text-to-Text
Transformers
Safetensors
English
Chinese
qwen3_vl
ocr
multimodal
vision-language
adversarial ocr
grounded ocr
qwen3-vl
conversational
Instructions to use inclusionAI/ArmorOCR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use inclusionAI/ArmorOCR with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="inclusionAI/ArmorOCR") 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("inclusionAI/ArmorOCR") model = AutoModelForMultimodalLM.from_pretrained("inclusionAI/ArmorOCR", 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 inclusionAI/ArmorOCR with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "inclusionAI/ArmorOCR" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "inclusionAI/ArmorOCR", "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/inclusionAI/ArmorOCR
- SGLang
How to use inclusionAI/ArmorOCR 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 "inclusionAI/ArmorOCR" \ --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": "inclusionAI/ArmorOCR", "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 "inclusionAI/ArmorOCR" \ --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": "inclusionAI/ArmorOCR", "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 inclusionAI/ArmorOCR with Docker Model Runner:
docker model run hf.co/inclusionAI/ArmorOCR
| language: | |
| - en | |
| - zh | |
| license: apache-2.0 | |
| library_name: transformers | |
| tags: | |
| - ocr | |
| - multimodal | |
| - vision-language | |
| - adversarial ocr | |
| - grounded ocr | |
| - qwen3-vl | |
| base_model: | |
| - Qwen/Qwen3-VL-8B-Instruct | |
| pipeline_tag: image-text-to-text | |
| # ArmorOCR | |
| [](https://github.com/ant-research/ArmorOCR) | |
| [](https://arxiv.org/abs/2608.20122) | |
| [](https://www.apache.org/licenses/LICENSE-2.0) | |
| **ArmorOCR** is a two-stage framework for **grounded adversarial OCR perception** built on Qwen3-VL-8B-Instruct. It enables single-pass inference on the original image, without any inference-time visual transformations or tool assistance. | |
| 📖 For training details, the AdvSpot benchmark, and evaluation scripts, please visit the [GitHub repo](https://github.com/ant-research/ArmorOCR). | |
| ## Quickstart | |
| ```bash | |
| pip install transformers==4.57.1 accelerate | |
| ``` | |
| ```python | |
| from transformers import Qwen3VLForConditionalGeneration, AutoProcessor | |
| model = Qwen3VLForConditionalGeneration.from_pretrained( | |
| "inclusionAI/ArmorOCR", dtype="auto", device_map="auto", | |
| ) | |
| processor = AutoProcessor.from_pretrained("inclusionAI/ArmorOCR") | |
| messages = [{ | |
| "role": "user", | |
| "content": [ | |
| {"type": "image", "image": "path/to/image.png"}, | |
| {"type": "text", | |
| "text": ("Please identify the text in the image. " | |
| "Put your reasoning inside <analyze></analyze> " | |
| "and your final recognized text inside <answer></answer>.")}, | |
| ], | |
| }] | |
| inputs = processor.apply_chat_template( | |
| messages, tokenize=True, add_generation_prompt=True, | |
| return_dict=True, return_tensors="pt", | |
| ).to(model.device) | |
| out = model.generate(**inputs, max_new_tokens=256) | |
| trimmed = [o[len(i):] for i, o in zip(inputs.input_ids, out)] | |
| print(processor.batch_decode(trimmed, skip_special_tokens=True)) | |
| ``` | |
| ## License | |
| Released under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). Use is additionally subject to the license and acceptable-use policy of the base model [Qwen/Qwen3-VL-8B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct). | |
| ## Citation | |
| ```bibtex | |
| @misc{cao2026armorocrgroundedadversarialvisual, | |
| title={ArmorOCR: Grounded Adversarial Visual Perception via Observation-Transferred Self-Distillation}, | |
| author={Linhan Cao and Siyuan Li and Jun Lan and Liangbo He and Guannan Li and Xiaolei Huang and Jun Jia and Shuheng Zhou and Huijia Zhu and Weiqiang Wang and Wei Sun}, | |
| year={2026}, | |
| eprint={2608.20122}, | |
| archivePrefix={arXiv}, | |
| primaryClass={cs.CV}, | |
| url={https://arxiv.org/abs/2608.20122}, | |
| } | |
| ``` |