Image-Text-to-Text
Transformers
Safetensors
Chinese
English
qwen2_vl
conversational
Eval Results
text-generation-inference
Instructions to use opendatalab/MinerU2.5-2509-1.2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use opendatalab/MinerU2.5-2509-1.2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="opendatalab/MinerU2.5-2509-1.2B") 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("opendatalab/MinerU2.5-2509-1.2B") model = AutoModelForMultimodalLM.from_pretrained("opendatalab/MinerU2.5-2509-1.2B", 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 opendatalab/MinerU2.5-2509-1.2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "opendatalab/MinerU2.5-2509-1.2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "opendatalab/MinerU2.5-2509-1.2B", "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/opendatalab/MinerU2.5-2509-1.2B
- SGLang
How to use opendatalab/MinerU2.5-2509-1.2B 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 "opendatalab/MinerU2.5-2509-1.2B" \ --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": "opendatalab/MinerU2.5-2509-1.2B", "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 "opendatalab/MinerU2.5-2509-1.2B" \ --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": "opendatalab/MinerU2.5-2509-1.2B", "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 opendatalab/MinerU2.5-2509-1.2B with Docker Model Runner:
docker model run hf.co/opendatalab/MinerU2.5-2509-1.2B
Update README
Browse files
README.md
CHANGED
|
@@ -7,8 +7,51 @@ pipeline_tag: image-text-to-text
|
|
| 7 |
library_name: transformers
|
| 8 |
---
|
| 9 |
|
| 10 |
-
MinerU2.5 (Pre-release)
|
| 11 |
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
library_name: transformers
|
| 8 |
---
|
| 9 |
|
|
|
|
| 10 |
|
| 11 |
+
# MinerU2.5
|
| 12 |
|
| 13 |
+
We are releasing MinerU2.5, a 1.2B-parameter visual-language model specialized in OCR and document parsing, enabling more accurate and robust parsing of complex and diverse real-world documents.
|
| 14 |
+
|
| 15 |
+
The model weights are stable and available for use, primarily intended for internal development and demonstration purposes.
|
| 16 |
+
|
| 17 |
+
> ⚠️ A full technical report, source code, and a comprehensive README will be released later this month. Stay tuned!
|
| 18 |
+
|
| 19 |
+
## Quick Start
|
| 20 |
+
For convenience, we provide a python package named `mineru-vl-utils` to smoothly use the MinerU2.5 Vision-Language Model. For more information and usages, please refer to [mineru-vl-utils](https://github.com/opendatalab/mineru-vl-utils/tree/main).
|
| 21 |
+
|
| 22 |
+
Here we give a simple example to use MinerU2.5 with 🤗 Transformers.
|
| 23 |
+
|
| 24 |
+
### Install packages
|
| 25 |
+
``` bash
|
| 26 |
+
pip install mineru-vl-utils[transformers]
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
### Run with Transformers
|
| 30 |
+
``` python
|
| 31 |
+
from transformers import AutoProcessor, Qwen2VLForConditionalGeneration
|
| 32 |
+
from PIL import Image
|
| 33 |
+
from mineru_vl_utils import MinerUClient
|
| 34 |
+
|
| 35 |
+
model_path = "opendatalab/MinerU2.5-2509-1.2B"
|
| 36 |
+
|
| 37 |
+
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
| 38 |
+
model_path,
|
| 39 |
+
dtype="auto",
|
| 40 |
+
device_map="auto"
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
processor = AutoProcessor.from_pretrained(
|
| 44 |
+
model_path,
|
| 45 |
+
use_fast=True
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
client = MinerUClient(
|
| 49 |
+
backend="transformers",
|
| 50 |
+
model=model,
|
| 51 |
+
processor=processor
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
image_path = '/path/to/your/image'
|
| 55 |
+
image = Image.open(image_path)
|
| 56 |
+
extracted_blocks = client.two_step_extract(image)
|
| 57 |
+
```
|