Image-Text-to-Text
Safetensors
Transformers
English
Chinese
multilingual
dots_mocr
dots_ocr
text-generation
image-to-text
ocr
document-parse
layout
table
formula
custom_code
conversational
Instructions to use dots-studio/dots.mocr-svg with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dots-studio/dots.mocr-svg with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="dots-studio/dots.mocr-svg", trust_remote_code=True) 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 AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("dots-studio/dots.mocr-svg", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use dots-studio/dots.mocr-svg with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dots-studio/dots.mocr-svg" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dots-studio/dots.mocr-svg", "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/dots-studio/dots.mocr-svg
- SGLang
How to use dots-studio/dots.mocr-svg 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 "dots-studio/dots.mocr-svg" \ --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": "dots-studio/dots.mocr-svg", "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 "dots-studio/dots.mocr-svg" \ --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": "dots-studio/dots.mocr-svg", "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 dots-studio/dots.mocr-svg with Docker Model Runner:
docker model run hf.co/dots-studio/dots.mocr-svg
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -566,7 +566,7 @@ cd dots.mocr
|
|
| 566 |
pip install -e .
|
| 567 |
```
|
| 568 |
|
| 569 |
-
If you have trouble with the installation,
|
| 570 |
|
| 571 |
|
| 572 |
### Download Model Weights
|
|
@@ -581,15 +581,15 @@ python3 tools/download_model.py --type modelscope
|
|
| 581 |
|
| 582 |
## 2. Deployment
|
| 583 |
### vLLM inference
|
| 584 |
-
We highly recommend using vLLM for deployment and inference. **Since vLLM version 0.11.0, Dots OCR has been officially integrated into vLLM with verified performance** and you can use vLLM docker image directly (e.g, `vllm/vllm-openai:v0.
|
| 585 |
|
| 586 |
```shell
|
| 587 |
# Launch vLLM model server
|
| 588 |
## dots.mocr
|
| 589 |
-
CUDA_VISIBLE_DEVICES=0 vllm serve rednote-hilab/dots.mocr --tensor-parallel-size 1 --gpu-memory-utilization 0.9 --chat-template-content-format string --
|
| 590 |
|
| 591 |
## dots.mocr-svg
|
| 592 |
-
CUDA_VISIBLE_DEVICES=0 vllm serve rednote-hilab/dots.mocr-svg --tensor-parallel-size 1 --gpu-memory-utilization 0.9 --chat-template-content-format string --
|
| 593 |
|
| 594 |
# vLLM API Demo
|
| 595 |
# See dots_mocr/model/inference.py and dots_mocr/utils/prompts.py for details on parameter and prompt settings
|
|
|
|
| 566 |
pip install -e .
|
| 567 |
```
|
| 568 |
|
| 569 |
+
If you have trouble with the installation, we recommend to use vLLM inference. Try official vLLM [Docker Image](https://hub.docker.com/layers/vllm/vllm-openai/v0.17.1-cu130/images/sha256-ec9b626d16b2af377662d9d31c1784aac5174b571450a1e25ffd90ddb639f2d2) for an easier setup, and follow these steps:
|
| 570 |
|
| 571 |
|
| 572 |
### Download Model Weights
|
|
|
|
| 581 |
|
| 582 |
## 2. Deployment
|
| 583 |
### vLLM inference
|
| 584 |
+
We highly recommend using vLLM for deployment and inference. **Since vLLM version 0.11.0, Dots OCR has been officially integrated into vLLM with verified performance** and you can use vLLM docker image directly (e.g, `vllm/vllm-openai:v0.17.1`) to deploy the model server.
|
| 585 |
|
| 586 |
```shell
|
| 587 |
# Launch vLLM model server
|
| 588 |
## dots.mocr
|
| 589 |
+
CUDA_VISIBLE_DEVICES=0 vllm serve rednote-hilab/dots.mocr --tensor-parallel-size 1 --gpu-memory-utilization 0.9 --chat-template-content-format string --trust-remote-code
|
| 590 |
|
| 591 |
## dots.mocr-svg
|
| 592 |
+
CUDA_VISIBLE_DEVICES=0 vllm serve rednote-hilab/dots.mocr-svg --tensor-parallel-size 1 --gpu-memory-utilization 0.9 --chat-template-content-format string --trust-remote-code
|
| 593 |
|
| 594 |
# vLLM API Demo
|
| 595 |
# See dots_mocr/model/inference.py and dots_mocr/utils/prompts.py for details on parameter and prompt settings
|