GautamKishore commited on
Commit
b2aa51f
Β·
verified Β·
1 Parent(s): 9f9d75c

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +24 -91
README.md CHANGED
@@ -21,106 +21,39 @@ base_model: eulogik/TinyDoc-VLM-256M
21
  library_name: peft
22
  pipeline_tag: visual-question-answering
23
  ---
24
-
25
  # TinyDoc-VLM LoRA Checkpoint
26
 
27
- > **Fine-tuned document AI.** 2.7M trainable params. 15 hours on a Mac. Loss: 43 β†’ 15.
28
-
29
- [![GitHub](https://img.shields.io/badge/GitHub-⭐-181717?logo=github)](https://github.com/eulogik/TinyDoc-VLM)
30
- [![Base Model](https://img.shields.io/badge/Base-eulogik/TinyDoc--VLM--256M-yellow)](https://huggingface.co/eulogik/TinyDoc-VLM-256M)
31
- [![HF Space](https://img.shields.io/badge/πŸ€—-Demo-yellow)](https://huggingface.co/spaces/eulogik/TinyDoc-VLM)
32
-
33
- ## What is this?
34
-
35
- A **LoRA adapter** for TinyDoc-VLM-256M that fine-tunes the model on document understanding tasks. Only **2.7M params** (0.93% of total) are trained, making it efficient to train and deploy.
36
-
37
- ## Quick Start
38
 
39
- ```python
40
- from tinydoc_vlm import TinyDocVLMForConditionalGeneration, TinyDocVLMProcessor
41
- from peft import PeftModel
42
 
43
- # Load base model
44
- model = TinyDocVLMForConditionalGeneration.from_pretrained("eulogik/TinyDoc-VLM-256M")
 
 
45
 
46
- # Apply LoRA adapter
47
- model = PeftModel.from_pretrained(model, "eulogik/TinyDoc-VLM-LoRA")
48
-
49
- # Merge for inference (optional, but faster)
50
- model = model.merge_and_unload()
51
-
52
- processor = TinyDocVLMProcessor()
53
- ```
54
-
55
- ## Training Details
56
 
57
  | Parameter | Value |
58
- |-----------|-------|
59
- | Base model | [eulogik/TinyDoc-VLM-256M](https://huggingface.co/eulogik/TinyDoc-VLM-256M) |
60
- | LoRA rank | 16 |
61
- | LoRA alpha | 32 |
62
- | Trainable params | 2,727,936 (0.93% of total) |
63
  | Target modules | q_proj, v_proj, k_proj, o_proj |
64
- | Training data | 3,000 synthetic documents (6,815 QA pairs) |
65
- | Training steps | 17,000 |
66
- | Best step | 14,000 (loss: 15.0) |
67
- | Final loss | 17.2 (from 43.3) |
68
- | Hardware | Apple M4 Mac |
69
- | Training time | 15.1 hours |
70
-
71
- ## Training Curve
72
-
73
- ```
74
- Step 25: 43.3 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
75
- Step 500: 25.7 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
76
- Step 1000: 20.9 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
77
- Step 5000: 18.6 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
78
- Step 10000: 16.5 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
79
- Step 14000: 15.0 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β˜… Best
80
- Step 17000: 17.2 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
81
- ```
82
-
83
- ## What This Trains
84
-
85
- - **Document OCR** β€” Printed text recognition
86
- - **Form field extraction** β€” Key-value pair extraction
87
- - **Receipt/invoice parsing** β€” Amount, date, vendor extraction
88
- - **Table structure understanding** β€” Cell extraction
89
- - **Visual question answering** β€” Answer questions about documents
90
-
91
- ## How to Reproduce
92
-
93
- ```bash
94
- # Clone repo
95
- git clone https://github.com/eulogik/TinyDoc-VLM.git
96
- cd TinyDoc-VLM
97
- pip install -e .
98
-
99
- # Generate synthetic docs
100
- python data/synthetic/generator.py --num-docs 3000 --output-dir data/synthetic/output
101
-
102
- # Train LoRA (17K steps, ~15 hours on M4)
103
- python training/fast_train.py --manifest data/synthetic/output/manifest.jsonl --data-root data/synthetic --steps 17000 --batch-size 1 --grad-accum 4 --device mps
104
-
105
- # Or use overnight script
106
- bash training/overnight_train.sh
107
- ```
108
-
109
- ## Next Steps
110
-
111
- - Scale to 10K+ documents
112
- - Add public benchmarks (DocVQA, FUNSD, CORD)
113
- - Train for 50K+ steps
114
- - Export to ONNX
115
-
116
- ## Links
117
 
118
- | Resource | URL |
119
- |----------|-----|
120
- | Base Model | [eulogik/TinyDoc-VLM-256M](https://huggingface.co/eulogik/TinyDoc-VLM-256M) |
121
- | GitHub | [github.com/eulogik/TinyDoc-VLM](https://github.com/eulogik/TinyDoc-VLM) |
122
- | Live Demo | [huggingface.co/spaces/eulogik/TinyDoc-VLM](https://huggingface.co/spaces/eulogik/TinyDoc-VLM) |
123
- | Training Script | [training/fast_train.py](https://github.com/eulogik/TinyDoc-VLM/blob/main/training/fast_train.py) |
124
 
125
  ## License
126
 
 
21
  library_name: peft
22
  pipeline_tag: visual-question-answering
23
  ---
24
+ ---
25
  # TinyDoc-VLM LoRA Checkpoint
26
 
27
+ > ## ⚠️ RETIRED β€” adapter makes outputs worse
28
+ >
29
+ > This LoRA adapter is part of the failed training line of the 256M checkpoint.
30
+ > In paired evaluation it **degrades generation into literal degeneration**
31
+ > (`"$ "$ "$"`, `22222`) compared even already-broken base weights, which
32
+ > themselves measure **0.0% OCRBench (n=1,000)**. Loss values below are training
33
+ > loss only β€” they never correlated with output quality. Kept for
34
+ > reproducibility; do not use for extraction.
 
 
 
35
 
36
+ ## What actually ships
 
 
37
 
38
+ The working product is the **local grounded-extraction SDK** running on free
39
+ `ollama:qwen2.5vl:3b` β€” measured **SROIE field F1 0.870 vs 0.376** for the free
40
+ PP-OCR+heuristics competitor (same 100 docs, same scorer):
41
+ [github.com/eulogik/TinyDoc-VLM](https://github.com/eulogik/TinyDoc-VLM).
42
 
43
+ ## Historical training record (2026-06)
 
 
 
 
 
 
 
 
 
44
 
45
  | Parameter | Value |
46
+ |---|---|
47
+ | Base model | [eulogik/TinyDoc-VLM-256M](https://huggingface.co/eulogik/TinyDoc-VLM-256M) (retired) |
48
+ | LoRA rank / alpha | 16 / 32 |
49
+ | Trainable params | 2,727,936 (0.93%) |
 
50
  | Target modules | q_proj, v_proj, k_proj, o_proj |
51
+ | Data | 3,000 synthetic documents (6,815 QA pairs) |
52
+ | Steps / best step | 17,000 / 14,000 (train loss 15.0) |
53
+ | Hardware / time | Apple M4, 15.1 h |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
+ Training loss trajectory (loss only β€” not a quality metric):
56
+ `43.3 β†’ 25.7 β†’ 20.9 β†’ 18.6 β†’ 16.5 β†’ 15.0 (best, step 14k) β†’ 17.2 (final)`
 
 
 
 
57
 
58
  ## License
59