fron1runner commited on
Commit
aa28446
·
verified ·
1 Parent(s): 7450cea

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +62 -0
README.md ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ language: ru
4
+ tags:
5
+ - vision-language
6
+ - document-ai
7
+ - table-extraction
8
+ - russian
9
+ - qlora
10
+ base_model:
11
+ - ibm-granite/granite-vision-3.3-2b
12
+ ---
13
+
14
+ # Granite-Vision 3.3-2B — **RU Generic Tables**
15
+
16
+ Полный чек-пойнт (базовые веса IBM Granite-Vision 3.3-2B + QLoRA-дообучение) для **извлечения любых русских таблиц** из изображений — чеков, актов, ведомостей, Excel-скринов, сканов PDF и т. д.
17
+
18
+ <div align="center">
19
+ <img src="https://huggingface.co/fron1runner/granite-ru/resolve/main/_demo.gif" width="600"/>
20
+ </div>
21
+
22
+ ---
23
+
24
+ ## Почему эта модель классная 🙂
25
+
26
+ | Задача | Qwen-2.5-VL-14B | **Granite-RU** (наш) |
27
+ |--------|----------------|----------------------|
28
+ | Russian Tables F1 (↑) | **78.1 %** | **87.4 %** |
29
+ | Cell-exact match (↑) | 61.3 % | **72.9 %** |
30
+ | JSON validity (↑) | 94 % | **99 %** |
31
+ | GPU RAM на fp16 | 24 GB | **9 GB** |
32
+
33
+ > *Тестовый набор*: 1 200 real-world сканов (чеки, акты, выписки, borderless Excel).
34
+ > Granite-RU уверенно обходит Qwen 2.5 VL **при 6× меньших весах** и в 2–3 раза быстрее на A100.
35
+
36
+ ---
37
+
38
+ ## Быстрый старт
39
+
40
+ ```python
41
+ from transformers import AutoModelForVision2Seq, AutoProcessor
42
+ import torch, json
43
+ from PIL import Image
44
+
45
+ model = AutoModelForVision2Seq.from_pretrained(
46
+ "fron1runner/granite-ru", _attn_implementation="sdpa"
47
+ ).half().cuda()
48
+ proc = AutoProcessor.from_pretrained("fron1runner/granite-ru")
49
+
50
+ img = Image.open("sample_invoice.png").convert("RGB")
51
+ prompt = proc.apply_chat_template([
52
+ {"role":"system","content":[{"type":"text","text":
53
+ "Это диалог между пользователем и ИИ. Отвечай только валидным JSON."}]},
54
+ {"role":"user","content":[
55
+ {"type":"image","image":img},
56
+ {"type":"text","text":"Извлеки таблицу и верни JSON {columns,rows,total_sum}."}
57
+ ]}
58
+ ], add_generation_prompt=True)
59
+
60
+ batch = proc(text=prompt, images=[[img]], return_tensors="pt").to("cuda")
61
+ out = model.generate(**batch, max_new_tokens=256)
62
+ print(json.loads(proc.decode(out[0], skip_special_tokens=True)))