Image-Text-to-Text
Transformers
Safetensors
English
qwen3_vl
document-understanding
information-extraction
vision-language
qwen3-vl
structured-data-extraction
multimodal
document-ai
conversational
Instructions to use objectai/obj_v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use objectai/obj_v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="objectai/obj_v1") 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("objectai/obj_v1") model = AutoModelForMultimodalLM.from_pretrained("objectai/obj_v1", 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 objectai/obj_v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "objectai/obj_v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "objectai/obj_v1", "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/objectai/obj_v1
- SGLang
How to use objectai/obj_v1 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 "objectai/obj_v1" \ --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": "objectai/obj_v1", "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 "objectai/obj_v1" \ --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": "objectai/obj_v1", "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 objectai/obj_v1 with Docker Model Runner:
docker model run hf.co/objectai/obj_v1
Update README.md
Browse files
README.md
CHANGED
|
@@ -9,18 +9,30 @@ tags:
|
|
| 9 |
- qwen3-vl
|
| 10 |
library_name: transformers
|
| 11 |
---
|
| 12 |
-
|
| 13 |
# obj_v1
|
| 14 |
-
|
| 15 |
Vision-language model fine-tuned for structured data extraction from Indian
|
| 16 |
financial documents. Give it a page image and a JSON schema; it returns the
|
| 17 |
schema filled in from what is on the page.
|
| 18 |
-
|
| 19 |
A 4B vision-language model, LoRA fine-tuned and merged. Nothing extra is needed
|
| 20 |
at load time -- it is a plain bf16 checkpoint.
|
| 21 |
|
| 22 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
|
|
|
| 24 |
```bash
|
| 25 |
vllm serve objectai/obj_v1 \
|
| 26 |
--served-model-name obj_v1 \
|
|
@@ -29,23 +41,16 @@ vllm serve objectai/obj_v1 \
|
|
| 29 |
--mm-processor-kwargs '{"max_pixels":1003520}' \
|
| 30 |
--trust-remote-code
|
| 31 |
```
|
| 32 |
-
|
| 33 |
`max_pixels` is 1280x28x28, the resolution the model was trained at. Raising it
|
| 34 |
wastes KV cache; lowering it makes small print unreadable.
|
| 35 |
-
|
| 36 |
## Calling it
|
| 37 |
-
|
| 38 |
The server is OpenAI-compatible, so an ordinary chat completion works:
|
| 39 |
-
|
| 40 |
```python
|
| 41 |
import base64, json, openai
|
| 42 |
-
|
| 43 |
client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
|
| 44 |
-
|
| 45 |
image = base64.b64encode(open("cheque.jpg", "rb").read()).decode()
|
| 46 |
schema = {"cheque_details": {"amount": "number", "payee": "string",
|
| 47 |
"date": "string", "cheque_number": "string"}}
|
| 48 |
-
|
| 49 |
response = client.chat.completions.create(
|
| 50 |
model="obj_v1",
|
| 51 |
temperature=0.0,
|
|
@@ -67,46 +72,32 @@ response = client.chat.completions.create(
|
|
| 67 |
)
|
| 68 |
print(response.choices[0].message.content)
|
| 69 |
```
|
| 70 |
-
|
| 71 |
## Prompt format
|
| 72 |
-
|
| 73 |
Match training or accuracy drops. The system prompt above is verbatim, and the
|
| 74 |
user turn is the image followed by exactly two lines:
|
| 75 |
-
|
| 76 |
```
|
| 77 |
document_type: <type>
|
| 78 |
schema: <compact json>
|
| 79 |
```
|
| 80 |
-
|
| 81 |
Set `temperature=0.0` so the same page yields the same answer.
|
| 82 |
-
|
| 83 |
## Requirements
|
| 84 |
-
|
| 85 |
| | |
|
| 86 |
| --- | --- |
|
| 87 |
| Weights | 8.9 GB (bf16) |
|
| 88 |
| VRAM | 16 GB minimum, 24 GB comfortable |
|
| 89 |
| Precision | bf16 (Ampere or newer; use fp16 below that) |
|
| 90 |
| Context | 16384 covers the longest documents |
|
| 91 |
-
|
| 92 |
Runs on an L4, A10G, L40S, A100 or RTX 4090. On a T4 add `--dtype float16`.
|
| 93 |
-
|
| 94 |
Long documents matter: `bank_statement` and `form16` answers run to ~2500
|
| 95 |
tokens, so `max_tokens` below 4096 truncates them mid-JSON.
|
| 96 |
-
|
| 97 |
## Output
|
| 98 |
-
|
| 99 |
Compact JSON matching the requested schema. Fields absent from the page come
|
| 100 |
back `null` rather than guessed. Values found on the page that the schema did
|
| 101 |
not ask for are placed under `extras` when that key is included in the schema.
|
| 102 |
-
|
| 103 |
## Limitations
|
| 104 |
-
|
| 105 |
- Trained on Indian financial documents; other domains and layouts are untested.
|
| 106 |
- Handwriting is the weakest case, particularly digits at low resolution.
|
| 107 |
- The model does not verify its own arithmetic. Totals that must reconcile
|
| 108 |
should be checked by the caller.
|
| 109 |
-
|
| 110 |
## License
|
| 111 |
-
|
| 112 |
-
Apache 2.0. Fine-tuned from Qwen3-VL-4B-Instruct, which is Apache 2.0.
|
|
|
|
| 9 |
- qwen3-vl
|
| 10 |
library_name: transformers
|
| 11 |
---
|
|
|
|
| 12 |
# obj_v1
|
|
|
|
| 13 |
Vision-language model fine-tuned for structured data extraction from Indian
|
| 14 |
financial documents. Give it a page image and a JSON schema; it returns the
|
| 15 |
schema filled in from what is on the page.
|
|
|
|
| 16 |
A 4B vision-language model, LoRA fine-tuned and merged. Nothing extra is needed
|
| 17 |
at load time -- it is a plain bf16 checkpoint.
|
| 18 |
|
| 19 |
+
## Authors
|
| 20 |
+
|
| 21 |
+
<p align="left">
|
| 22 |
+
<!-- <a href="https://www.linkedin.com/in/ahmedzaweel/">
|
| 23 |
+
<img src="https://img.shields.io/badge/LinkedIn-Ahmed%20Zaweel-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white" alt="Ahmed Zaweel on LinkedIn" />
|
| 24 |
+
</a> -->
|
| 25 |
+
|
| 26 |
+
<a href="https://www.linkedin.com/in/rachit-kumar-b41299228/">
|
| 27 |
+
<img src="https://img.shields.io/badge/LinkedIn-Rachit%20Kumar-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white" alt="Rachit Kumar on LinkedIn" />
|
| 28 |
+
</a>
|
| 29 |
+
|
| 30 |
+
<a href="https://www.linkedin.com/in/ahmedzaweel/">
|
| 31 |
+
<img src="https://img.shields.io/badge/LinkedIn-Ahmed%20Zaweel-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white" alt="Ahmed Zaweel on LinkedIn" />
|
| 32 |
+
</a>
|
| 33 |
+
</p>
|
| 34 |
|
| 35 |
+
## Serving with vLLM
|
| 36 |
```bash
|
| 37 |
vllm serve objectai/obj_v1 \
|
| 38 |
--served-model-name obj_v1 \
|
|
|
|
| 41 |
--mm-processor-kwargs '{"max_pixels":1003520}' \
|
| 42 |
--trust-remote-code
|
| 43 |
```
|
|
|
|
| 44 |
`max_pixels` is 1280x28x28, the resolution the model was trained at. Raising it
|
| 45 |
wastes KV cache; lowering it makes small print unreadable.
|
|
|
|
| 46 |
## Calling it
|
|
|
|
| 47 |
The server is OpenAI-compatible, so an ordinary chat completion works:
|
|
|
|
| 48 |
```python
|
| 49 |
import base64, json, openai
|
|
|
|
| 50 |
client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
|
|
|
|
| 51 |
image = base64.b64encode(open("cheque.jpg", "rb").read()).decode()
|
| 52 |
schema = {"cheque_details": {"amount": "number", "payee": "string",
|
| 53 |
"date": "string", "cheque_number": "string"}}
|
|
|
|
| 54 |
response = client.chat.completions.create(
|
| 55 |
model="obj_v1",
|
| 56 |
temperature=0.0,
|
|
|
|
| 72 |
)
|
| 73 |
print(response.choices[0].message.content)
|
| 74 |
```
|
|
|
|
| 75 |
## Prompt format
|
|
|
|
| 76 |
Match training or accuracy drops. The system prompt above is verbatim, and the
|
| 77 |
user turn is the image followed by exactly two lines:
|
|
|
|
| 78 |
```
|
| 79 |
document_type: <type>
|
| 80 |
schema: <compact json>
|
| 81 |
```
|
|
|
|
| 82 |
Set `temperature=0.0` so the same page yields the same answer.
|
|
|
|
| 83 |
## Requirements
|
|
|
|
| 84 |
| | |
|
| 85 |
| --- | --- |
|
| 86 |
| Weights | 8.9 GB (bf16) |
|
| 87 |
| VRAM | 16 GB minimum, 24 GB comfortable |
|
| 88 |
| Precision | bf16 (Ampere or newer; use fp16 below that) |
|
| 89 |
| Context | 16384 covers the longest documents |
|
|
|
|
| 90 |
Runs on an L4, A10G, L40S, A100 or RTX 4090. On a T4 add `--dtype float16`.
|
|
|
|
| 91 |
Long documents matter: `bank_statement` and `form16` answers run to ~2500
|
| 92 |
tokens, so `max_tokens` below 4096 truncates them mid-JSON.
|
|
|
|
| 93 |
## Output
|
|
|
|
| 94 |
Compact JSON matching the requested schema. Fields absent from the page come
|
| 95 |
back `null` rather than guessed. Values found on the page that the schema did
|
| 96 |
not ask for are placed under `extras` when that key is included in the schema.
|
|
|
|
| 97 |
## Limitations
|
|
|
|
| 98 |
- Trained on Indian financial documents; other domains and layouts are untested.
|
| 99 |
- Handwriting is the weakest case, particularly digits at low resolution.
|
| 100 |
- The model does not verify its own arithmetic. Totals that must reconcile
|
| 101 |
should be checked by the caller.
|
|
|
|
| 102 |
## License
|
| 103 |
+
Apache 2.0. Fine-tuned from Qwen3-VL-4B-Instruct, which is Apache 2.0.
|
|
|