rabbit commited on
Commit
f4708fd
·
1 Parent(s): 10e013e

update README.md

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