GoktugD commited on
Commit
32fd322
·
verified ·
1 Parent(s): 77eb74f

Werea-DocOCR-1B: Turkish enterprise document OCR (LightOnOCR-2-1B-base SFT)

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
chat_template.jinja ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% set image_count = namespace(value=0) %}
2
+ {% for message in messages %}
3
+ {% if loop.first and message['role'] != 'system' %}
4
+ <|im_start|>system<|im_end|>
5
+ {% endif %}
6
+ <|im_start|>{{ message['role'] }}
7
+ {% if message['content'] is string %}
8
+ {{ message['content'] }}<|im_end|>
9
+ {% else %}
10
+ {% for content in message['content'] %}
11
+ {% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}
12
+ {% set image_count.value = image_count.value + 1 %}
13
+ {% if add_vision_id %}
14
+ Picture {{ image_count.value }}:
15
+ {% endif -%}
16
+ <|image_pad|>
17
+ {%- elif 'text' in content %}
18
+ {{ content['text'] }}
19
+ {% endif %}
20
+ {% endfor %}
21
+ <|im_end|>
22
+ {% endif %}
23
+ {% endfor %}
24
+ {% if add_generation_prompt %}
25
+ <|im_start|>assistant
26
+ {% endif %}
config.json ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LightOnOcrForConditionalGeneration"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "eos_token_id": 151645,
7
+ "image_token_id": 151655,
8
+ "model_type": "lighton_ocr",
9
+ "multimodal_projector_bias": false,
10
+ "pad_token_id": 151643,
11
+ "projector_hidden_act": "gelu",
12
+ "spatial_merge_size": 2,
13
+ "text_config": {
14
+ "architectures": [
15
+ "Qwen3ForCausalLM"
16
+ ],
17
+ "attention_bias": false,
18
+ "attention_dropout": 0,
19
+ "bos_token_id": null,
20
+ "dtype": "bfloat16",
21
+ "eos_token_id": null,
22
+ "head_dim": 128,
23
+ "hidden_act": "silu",
24
+ "hidden_size": 1024,
25
+ "initializer_range": 0.02,
26
+ "intermediate_size": 3072,
27
+ "layer_types": [
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention",
49
+ "full_attention",
50
+ "full_attention",
51
+ "full_attention",
52
+ "full_attention",
53
+ "full_attention",
54
+ "full_attention",
55
+ "full_attention"
56
+ ],
57
+ "max_position_embeddings": 16384,
58
+ "max_window_layers": 28,
59
+ "model_type": "qwen3",
60
+ "num_attention_heads": 16,
61
+ "num_hidden_layers": 28,
62
+ "num_key_value_heads": 8,
63
+ "pad_token_id": null,
64
+ "rms_norm_eps": 1e-06,
65
+ "rope_parameters": {
66
+ "rope_theta": 1000000,
67
+ "rope_type": "default"
68
+ },
69
+ "sliding_window": null,
70
+ "tie_word_embeddings": true,
71
+ "use_cache": true,
72
+ "use_qk_norm": true,
73
+ "use_sliding_window": false,
74
+ "vocab_size": 151936
75
+ },
76
+ "tie_word_embeddings": true,
77
+ "transformers_version": "5.15.0",
78
+ "vision_config": {
79
+ "attention_dropout": 0,
80
+ "dtype": "bfloat16",
81
+ "head_dim": 64,
82
+ "hidden_act": "silu",
83
+ "hidden_size": 1024,
84
+ "image_size": 1540,
85
+ "initializer_range": 0.02,
86
+ "intermediate_size": 4096,
87
+ "model_type": "pixtral",
88
+ "num_attention_heads": 16,
89
+ "num_channels": 3,
90
+ "num_hidden_layers": 24,
91
+ "patch_size": 14,
92
+ "rope_parameters": {
93
+ "rope_theta": 10000,
94
+ "rope_type": "default"
95
+ }
96
+ },
97
+ "vision_feature_layer": -1
98
+ }
evaluation.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base_model": "lightonai/LightOnOCR-2-1B-base",
3
+ "train_samples": 3000,
4
+ "epochs": 2,
5
+ "optimizer_steps": 375,
6
+ "lr": 1e-05,
7
+ "eval_pages": 30,
8
+ "base_cer": {
9
+ "mean": 0.6416954423539845,
10
+ "median": 0.6164383561643836
11
+ },
12
+ "finetuned_cer": {
13
+ "mean": 0.0011501285580295681,
14
+ "median": 0.0010395010395010396
15
+ },
16
+ "base_pred_samples": [
17
+ {
18
+ "file": "vekaletname_test_0000.jpg",
19
+ "cer": 0.1850828729281768,
20
+ "pred_head": "# T.C. GAZIANTEP 2. NOTERLİĞİ\n\n## GENEL VEKALETNAME\n\n<table>\n <tr>\n <td>Yevmiye No</td>\n <td>82083</td>\n </tr>\n <tr>\n <td>Tarih</td>\n <td>04.05.2025</td>\n </tr>\n <tr>\n <td>Vekalet Veren</td>\n <td>Ali Avcı — T.C. Kimlik No: 29378410092</td>\n </tr>\n <tr>\n <td>Adresi</td>\n <td>Orhangazi Mah. Vatan Caddesi No: 146, Odunpazarı / Eskişehir</td>\n </tr>\n <tr>\n <td>Vekil"
21
+ },
22
+ {
23
+ "file": "vekaletname_test_0001.jpg",
24
+ "cer": 0.26173020527859236,
25
+ "pred_head": "# T.C. KAYSERI 34. NOTERLİĞİ\n\n## GENEL VEKALETNAME\n\n<table>\n <thead>\n <tr>\n <th>Yevmiye No</th>\n <th>49485</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Tarih</td>\n <td>13.11.2023</td>\n </tr>\n <tr>\n <td>Vekalet Veren</td>\n <td>Aslı Ateş — T.C. Kimlik No: 55927559264</td>\n </tr>\n <tr>\n <td>Adresi</td>\n <td>Zafer Mah. Bağdat Caddesi No: 140"
26
+ },
27
+ {
28
+ "file": "vekaletname_test_0002.jpg",
29
+ "cer": 0.2773722627737226,
30
+ "pred_head": "# T.C. İZMİR 30. NOTERLİĞİ\n\n## GENEL VEKALETNAME\n\n<table>\n <thead>\n <tr>\n <th>Yevmiye No</th>\n <th>94329</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Tarih</td>\n <td>18.10.2026</td>\n </tr>\n <tr>\n <td>Vekalet Veren</td>\n <td>Tolga Aslan — T.C. Kimlik No: 99153535852</td>\n </tr>\n <tr>\n <td>Adresi</td>\n <td>Fatih Mah. Gazi Bulvarı No: 171/B"
31
+ },
32
+ {
33
+ "file": "vekaletname_test_0003.jpg",
34
+ "cer": 0.20121951219512196,
35
+ "pred_head": "# T.C. KAYSERI 23. NOTERLİĞİ\n\n## GENEL VEKALETNAME\n\n<table>\n <tr>\n <td>Yevmiye No</td>\n <td>91467</td>\n </tr>\n <tr>\n <td>Tarih</td>\n <td>02.08.2026</td>\n </tr>\n <tr>\n <td>Vekalet Veren</td>\n <td>Tolga Avcı — T.C. Kimlik No: 19760557368</td>\n </tr>\n <tr>\n <td>Adresi</td>\n <td>Cumhuriyet Mah. İstiklal Caddesi No: 137/A, Kocasinan / Kayseri</td>\n </tr>\n <tr>\n <td>V"
36
+ }
37
+ ],
38
+ "finetuned_pred_samples": [
39
+ {
40
+ "file": "vekaletname_test_0000.jpg",
41
+ "cer": 0.0006906077348066298,
42
+ "pred_head": "T.C. GAZIANTEP 2. NOTERLİĞİ\n\n# GENEL VEKALETNAME\n\n**Yevmiye No:** 82083 \n**Tarih:** 04.05.2025 \n**Vekalet Veren:** Ali Avcı — T.C. Kimlik No: 29378410092 \n**Adresi:** Orhangazi Mah. Vatan Caddesi No: 146, Odunpazarı / Eskişehir \n**Vekil:** Ayşe Uçar — T.C. Kimlik No: 27904330760 \n**Vekil Adresi:** Gültepe Mah. İstiklal Caddesi No: 78/A, Şahinbey / Gaziantep \n\nYukarıda açık kimliği yazılı bul"
43
+ },
44
+ {
45
+ "file": "vekaletname_test_0001.jpg",
46
+ "cer": 0.0007331378299120235,
47
+ "pred_head": "T.C. KAYSERI 34. NOTERLİĞİ\n\n# GENEL VEKALETNAME\n\n**Yevmiye No:** 49485 \n**Tarih:** 13.11.2023 \n**Vekalet Veren:** Aslı Ateş — T.C. Kimlik No: 55927559264 \n**Adresi:** Zafer Mah. Bağdat Caddesi No: 140, Yüreğir / Adana \n**Vekil:** Aslı Doğan — T.C. Kimlik No: 62917968524 \n**Vekil Adresi:** Yeşilyurt Mah. Menderes Bulvarı No: 21 Kat: 6, Konyaaltı / Antalya \n\nYukarıda açık kimliği yazılı buluna"
48
+ },
49
+ {
50
+ "file": "vekaletname_test_0002.jpg",
51
+ "cer": 0.00072992700729927,
52
+ "pred_head": "T.C. İZMIR 30. NOTERLİĞİ\n\n# GENEL VEKALETNAME\n\n**Yevmiye No:** 94329 \n**Tarih:** 18.10.2026 \n**Vekalet Veren:** Tolga Aslan — T.C. Kimlik No: 99153535852 \n**Adresi:** Fatih Mah. Gazi Bulvarı No: 171/B, Tepebaşı / Eskişehir \n**Vekil:** Ceren Özdemir — T.C. Kimlik No: 74736047816 \n**Vekil Adresi:** Atatürk Mah. Şehitler Caddesi No: 179, Yıldırım / Bursa \n\nYukarıda açık kimliği yazılı bulunan b"
53
+ },
54
+ {
55
+ "file": "vekaletname_test_0003.jpg",
56
+ "cer": 0.0007621951219512195,
57
+ "pred_head": "T.C. KAYSERI 23. NOTERLİĞİ\n\n# GENEL VEKALETNAME\n\n**Yevmiye No:** 91467 \n**Tarih:** 02.08.2026 \n**Vekalet Veren:** Tolga Avcı — T.C. Kimlik No: 19760557368 \n**Adresi:** Cumhuriyet Mah. İstiklal Caddesi No: 137/A, Kocasinan / Kayseri \n**Vekil:** Onur Çetin — T.C. Kimlik No: 85438185652 \n**Vekil Adresi:** Mimar Sinan Mah. Gazi Bulvarı No: 108/B, Nilüfer / Bursa \n\nYukarıda açık kimliği yazılı bu"
58
+ }
59
+ ]
60
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "temperature": 0.2,
10
+ "top_k": 0,
11
+ "top_p": 0.9,
12
+ "transformers_version": "5.15.0"
13
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cce5d6164c878ab2a513ecbfe4149feb3d8ea6ebef66a9003a6e6b94f1f850c3
3
+ size 2011367496
processor_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "data_format": "channels_first",
4
+ "default_to_square": true,
5
+ "do_convert_rgb": true,
6
+ "do_normalize": true,
7
+ "do_rescale": true,
8
+ "do_resize": true,
9
+ "image_mean": [
10
+ 0.48145466,
11
+ 0.4578275,
12
+ 0.40821073
13
+ ],
14
+ "image_processor_type": "PixtralImageProcessor",
15
+ "image_std": [
16
+ 0.26862954,
17
+ 0.26130258,
18
+ 0.27577711
19
+ ],
20
+ "patch_size": 14,
21
+ "resample": 3,
22
+ "rescale_factor": 0.00392156862745098,
23
+ "size": {
24
+ "longest_edge": 1540
25
+ }
26
+ },
27
+ "patch_size": 14,
28
+ "processor_class": "LightOnOcrProcessor",
29
+ "spatial_merge_size": 2
30
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
3
+ size 11422654
tokenizer_config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "image_break_token": "<|vision_pad|>",
9
+ "image_end_token": "<|vision_end|>",
10
+ "image_token": "<|image_pad|>",
11
+ "is_local": false,
12
+ "local_files_only": false,
13
+ "max_length": null,
14
+ "model_max_length": 131072,
15
+ "model_specific_special_tokens": {
16
+ "image_break_token": "<|vision_pad|>",
17
+ "image_end_token": "<|vision_end|>",
18
+ "image_token": "<|image_pad|>"
19
+ },
20
+ "pad_to_multiple_of": null,
21
+ "pad_token": "<|endoftext|>",
22
+ "pad_token_type_id": 0,
23
+ "padding_side": "right",
24
+ "processor_class": "LightOnOcrProcessor",
25
+ "split_special_tokens": false,
26
+ "tokenizer_class": "TokenizersBackend",
27
+ "unk_token": null
28
+ }