rabbit commited on
Commit ·
bf9da05
1
Parent(s): 84d0bdc
update
Browse files
README.md
CHANGED
|
@@ -1,3 +1,106 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
- vi
|
| 6 |
+
tags:
|
| 7 |
+
- vision-language
|
| 8 |
+
- document-ai
|
| 9 |
+
- vlm
|
| 10 |
+
- ocr
|
| 11 |
+
pipeline_tag: image-to-text
|
| 12 |
---
|
| 13 |
+
|
| 14 |
+
# Doc2Bit-VL-8B-W8A8-Dynamic-Per-Token
|
| 15 |
+
|
| 16 |
+
Doc2Bit-VL-8B-W8A8-Dynamic-Per-Token is a vision-language model fine-tuned and quantized to 8-bit integers for document understanding.
|
| 17 |
+
|
| 18 |
+
# 📄 Document Information Extraction VLM
|
| 19 |
+
|
| 20 |
+
A Vision-Language Model (VLM) specialized in **document understanding and information extraction**, supporting both **unstructured information** and **structured data (tables)** from document images.
|
| 21 |
+
|
| 22 |
+
This model is optimized for production usage via **vLLM serving** with an **OpenAI-compatible API**.
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
## 🚀 Features
|
| 26 |
+
- Vision-Language Model for document images
|
| 27 |
+
- Extracts **unstructured key–value information**
|
| 28 |
+
- Extracts **structured table data**, including **column-wise extraction**
|
| 29 |
+
- Handles complex layouts (forms, invoices, reports, product tables)
|
| 30 |
+
- Strict output formatting (no hallucination)
|
| 31 |
+
- Compatible with **vLLM OpenAI-style API**
|
| 32 |
+
- Prompting optimized for **Vietnamese instructions**
|
| 33 |
+
---
|
| 34 |
+
|
| 35 |
+
## 📌 Supported Data Types
|
| 36 |
+
### 1. Unstructured Information
|
| 37 |
+
|
| 38 |
+
Extract specific fields defined by the user, such as:
|
| 39 |
+
- Invoice number
|
| 40 |
+
- Date
|
| 41 |
+
- Company name
|
| 42 |
+
- Address
|
| 43 |
+
- Total amount
|
| 44 |
+
- Custom document attributes
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
### 2. Structured Table Data
|
| 48 |
+
|
| 49 |
+
Designed for extracting **individual columns** from tables, especially product tables.
|
| 50 |
+
Capabilities:
|
| 51 |
+
- Column-level extraction
|
| 52 |
+
- Ignore non-product rows
|
| 53 |
+
- Markdown-formatted output
|
| 54 |
+
- Clean and deterministic structure
|
| 55 |
+
|
| 56 |
+
---
|
| 57 |
+
|
| 58 |
+
## 🔧 Deployment (vLLM)
|
| 59 |
+
This model is intended to be deployed using **vLLM** with an OpenAI-compatible interface.
|
| 60 |
+
Example:
|
| 61 |
+
```bash
|
| 62 |
+
vllm serve <model-path-or-name> \
|
| 63 |
+
--served-model-name document-vlm \
|
| 64 |
+
--port 8000
|
| 65 |
+
```
|
| 66 |
+
## Prompt Usage
|
| 67 |
+
Unstructured Data Extraction Prompt Example
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
prompt = f"""QUERY Trích xuất thông tin: {field_names}.
|
| 71 |
+
INSTRUCTION:
|
| 72 |
+
- Bắt buộc dữ liệu trả về theo format <index>. <key>:<value>, trong đó <index> là số thứ tự (1, 2, 3, 4, ...)
|
| 73 |
+
- key lấy chính xác từ trong QUERY của tôi
|
| 74 |
+
- không tự bịa dữ liệu và coi đó là điều hiển nhiên
|
| 75 |
+
- nếu không thể trích xuất thì hãy trả lời: tôi không thể tìm thấy dữ liệu này
|
| 76 |
+
"""
|
| 77 |
+
```
|
| 78 |
+
Expected Output
|
| 79 |
+
```bash
|
| 80 |
+
1. Số hóa đơn: INV-001
|
| 81 |
+
2. Ngày phát hành: 12/03/2024
|
| 82 |
+
3. Tổng tiền: 1.250.000 VND
|
| 83 |
+
```
|
| 84 |
+
If data cannot be extracted:
|
| 85 |
+
```bash
|
| 86 |
+
tôi không thể tìm thấy dữ liệu này
|
| 87 |
+
```
|
| 88 |
+
Structured Table (Column-wise) Extraction Prompt Example
|
| 89 |
+
|
| 90 |
+
```bash
|
| 91 |
+
prompt = (
|
| 92 |
+
f"trích xuất thông tin tương ứng với sản phẩm của cột {col_name} trong bảng sản phẩm.\n"
|
| 93 |
+
"INSTRUCTION:\n"
|
| 94 |
+
"Xuất kết quả dưới dạng markdown một cột.\n"
|
| 95 |
+
"Bỏ qua những hàng không phải sản phẩm.\n"
|
| 96 |
+
f"Yêu cầu tiêu đề cột là |{col_name}|.\n"
|
| 97 |
+
)
|
| 98 |
+
```
|
| 99 |
+
Expected Output
|
| 100 |
+
```bash
|
| 101 |
+
|Tên sản phẩm|
|
| 102 |
+
|------------|
|
| 103 |
+
|Sản phẩm A|
|
| 104 |
+
|Sản phẩm B|
|
| 105 |
+
|Sản phẩm C|
|
| 106 |
+
```
|