Image-Text-to-Text
Transformers
Safetensors
English
qwen2_5_vl
conversational
text-generation-inference
Instructions to use ChatDOC/OCRFlux-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ChatDOC/OCRFlux-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ChatDOC/OCRFlux-3B") 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("ChatDOC/OCRFlux-3B") model = AutoModelForImageTextToText.from_pretrained("ChatDOC/OCRFlux-3B") 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 ChatDOC/OCRFlux-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ChatDOC/OCRFlux-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ChatDOC/OCRFlux-3B", "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/ChatDOC/OCRFlux-3B
- SGLang
How to use ChatDOC/OCRFlux-3B 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 "ChatDOC/OCRFlux-3B" \ --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": "ChatDOC/OCRFlux-3B", "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 "ChatDOC/OCRFlux-3B" \ --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": "ChatDOC/OCRFlux-3B", "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 ChatDOC/OCRFlux-3B with Docker Model Runner:
docker model run hf.co/ChatDOC/OCRFlux-3B
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,34 +1,33 @@
|
|
| 1 |
-
---
|
| 2 |
-
language:
|
| 3 |
-
- en
|
| 4 |
-
license: apache-2.0
|
| 5 |
-
benchmarks:
|
| 6 |
-
- ChatDoc/OCRFlux-bench-single
|
| 7 |
-
- ChatDoc/OCRFlux-bench-cross
|
| 8 |
-
- ChatDoc/OCRFlux-pubtabnet-single
|
| 9 |
-
- ChatDoc/OCRFlux-pubtabnet-cross
|
| 10 |
-
base_model:
|
| 11 |
-
- Qwen/Qwen2.5-VL-3B-Instruct
|
| 12 |
-
library_name: transformers
|
| 13 |
-
---
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
The
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
OCRFlux is
|
| 34 |
-
OCRFlux is intended for research and educational use.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
benchmarks:
|
| 6 |
+
- ChatDoc/OCRFlux-bench-single
|
| 7 |
+
- ChatDoc/OCRFlux-bench-cross
|
| 8 |
+
- ChatDoc/OCRFlux-pubtabnet-single
|
| 9 |
+
- ChatDoc/OCRFlux-pubtabnet-cross
|
| 10 |
+
base_model:
|
| 11 |
+
- Qwen/Qwen2.5-VL-3B-Instruct
|
| 12 |
+
library_name: transformers
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# OCRFlux
|
| 17 |
+
|
| 18 |
+
This is a preview release of the OCRFlux model that's fine tuned from Qwen2.5-VL-3B-Instruct using the our private document datasets and some data from
|
| 19 |
+
[olmOCR-mix-0225](https://huggingface.co/datasets/allenai/olmOCR-mix-0225) dataset.
|
| 20 |
+
|
| 21 |
+
Quick links:
|
| 22 |
+
- 🛠️ [Code](https://github.com/chatdoc-com/OCRFlux)
|
| 23 |
+
|
| 24 |
+
## Usage
|
| 25 |
+
|
| 26 |
+
The best way to use this model is via the [OCRFlux toolkit](https://github.com/chatdoc-com/OCRFlux).
|
| 27 |
+
The toolkit comes with an efficient inference setup via vllm that can handle millions of documents
|
| 28 |
+
at scale.
|
| 29 |
+
|
| 30 |
+
## License and use
|
| 31 |
+
|
| 32 |
+
OCRFlux is licensed under the Apache 2.0 license.
|
| 33 |
+
OCRFlux is intended for research and educational use.
|
|
|