davanstrien HF Staff commited on
Commit
28da03a
·
verified ·
1 Parent(s): 1a94471

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +99 -43
README.md CHANGED
@@ -1,45 +1,101 @@
1
  ---
2
- dataset_info:
3
- features:
4
- - name: document_id
5
- dtype: string
6
- - name: page_number
7
- dtype: int32
8
- - name: file_identifier
9
- dtype: string
10
- - name: image
11
- dtype: image
12
- - name: text
13
- dtype: string
14
- - name: alto_xml
15
- dtype: string
16
- - name: has_image
17
- dtype: bool
18
- - name: has_alto
19
- dtype: bool
20
- - name: document_metadata
21
- dtype: string
22
- - name: has_metadata
23
- dtype: bool
24
- - name: exam_type
25
- dtype: string
26
- - name: exam_year
27
- dtype: string
28
- - name: exam_reference
29
- dtype: string
30
- - name: markdown
31
- dtype: string
32
- - name: inference_info
33
- dtype: string
34
- splits:
35
- - name: train
36
- num_bytes: 13336968
37
- num_examples: 100
38
- download_size: 9576133
39
- dataset_size: 13336968
40
- configs:
41
- - config_name: default
42
- data_files:
43
- - split: train
44
- path: data/train-*
45
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ tags:
3
+ - ocr
4
+ - document-processing
5
+ - hunyuan-ocr
6
+ - multilingual
7
+ - markdown
8
+ - uv-script
9
+ - generated
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ---
11
+
12
+ # Document OCR using HunyuanOCR
13
+
14
+ This dataset contains OCR results from images in [NationalLibraryOfScotland/Scottish-School-Exam-Papers](https://huggingface.co/datasets/NationalLibraryOfScotland/Scottish-School-Exam-Papers) using HunyuanOCR, a lightweight 1B VLM from Tencent.
15
+
16
+ ## Processing Details
17
+
18
+ - **Source Dataset**: [NationalLibraryOfScotland/Scottish-School-Exam-Papers](https://huggingface.co/datasets/NationalLibraryOfScotland/Scottish-School-Exam-Papers)
19
+ - **Model**: [tencent/HunyuanOCR](https://huggingface.co/tencent/HunyuanOCR)
20
+ - **Number of Samples**: 100
21
+ - **Processing Time**: 3.6 min
22
+ - **Processing Date**: 2025-11-25 15:51 UTC
23
+
24
+ ### Configuration
25
+
26
+ - **Image Column**: `image`
27
+ - **Output Column**: `markdown`
28
+ - **Dataset Split**: `train`
29
+ - **Batch Size**: 16
30
+ - **Prompt Mode**: parse-document
31
+ - **Prompt Language**: English
32
+ - **Max Model Length**: 16,384 tokens
33
+ - **Max Output Tokens**: 16,384
34
+ - **GPU Memory Utilization**: 80.0%
35
+
36
+ ## Model Information
37
+
38
+ HunyuanOCR is a lightweight 1B VLM that excels at:
39
+ - 📝 **Document Parsing** - Full markdown extraction with reading order
40
+ - 📊 **Table Extraction** - HTML format tables
41
+ - 📐 **Formula Recognition** - LaTeX format formulas
42
+ - 📈 **Chart Parsing** - Mermaid/Markdown format
43
+ - 📍 **Text Spotting** - Detection with coordinates
44
+ - 🔍 **Information Extraction** - Key-value, fields, subtitles
45
+ - 🌐 **Translation** - Multilingual photo translation
46
+
47
+ ## Prompt Modes Available
48
+
49
+ - `parse-document` - Full document parsing (default)
50
+ - `parse-formula` - LaTeX formula extraction
51
+ - `parse-table` - HTML table extraction
52
+ - `parse-chart` - Chart/flowchart parsing
53
+ - `spot` - Text detection with coordinates
54
+ - `extract-key` - Extract specific key value
55
+ - `extract-fields` - Extract multiple fields as JSON
56
+ - `extract-subtitles` - Subtitle extraction
57
+ - `translate` - Document translation
58
+
59
+ ## Dataset Structure
60
+
61
+ The dataset contains all original columns plus:
62
+ - `markdown`: The extracted text in markdown format
63
+ - `inference_info`: JSON list tracking all OCR models applied to this dataset
64
+
65
+ ## Usage
66
+
67
+ ```python
68
+ from datasets import load_dataset
69
+ import json
70
+
71
+ # Load the dataset
72
+ dataset = load_dataset("{output_dataset_id}", split="train")
73
+
74
+ # Access the markdown text
75
+ for example in dataset:
76
+ print(example["markdown"])
77
+ break
78
+
79
+ # View all OCR models applied to this dataset
80
+ inference_info = json.loads(dataset[0]["inference_info"])
81
+ for info in inference_info:
82
+ print(f"Column: {info['column_name']} - Model: {info['model_id']}")
83
+ ```
84
+
85
+ ## Reproduction
86
+
87
+ This dataset was generated using the [uv-scripts/ocr](https://huggingface.co/datasets/uv-scripts/ocr) HunyuanOCR script:
88
+
89
+ ```bash
90
+ uv run https://huggingface.co/datasets/uv-scripts/ocr/raw/main/hunyuan-ocr.py \
91
+ NationalLibraryOfScotland/Scottish-School-Exam-Papers \
92
+ <output-dataset> \
93
+ --image-column image \
94
+ --batch-size 16 \
95
+ --prompt-mode parse-document \
96
+ --max-model-len 16384 \
97
+ --max-tokens 16384 \
98
+ --gpu-memory-utilization 0.8
99
+ ```
100
+
101
+ Generated with [UV Scripts](https://huggingface.co/uv-scripts)