VictorChew commited on
Commit
e7dbc7c
Β·
verified Β·
1 Parent(s): 3ba82e8

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +137 -0
README.md ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - zh
5
+ pipeline_tag: image-to-text
6
+ inference: false
7
+ license: apache-2.0
8
+ ---
9
+
10
+ <div align="center">
11
+ <h1>StructEqTable-Deploy: A High-efficiency Open-source Toolkit for Table-to-Latex Transformation</h1>
12
+
13
+
14
+ [[ Github Repo ]](https://github.com/UniModal4Reasoning/StructEqTable-Deploy) [[ Related Paper ]](https://arxiv.org/abs/2406.11633) [[ Website ]](https://unimodal4reasoning.github.io/DocGenome_page/)
15
+
16
+ [[ Dataset (Google Drive)]](https://drive.google.com/drive/folders/1OIhnuQdIjuSSDc_QL2nP4NwugVDgtItD) [[ Dataset (Hugging Face) ]](https://huggingface.co/datasets/U4R/DocGenome/tree/main) [[Models πŸ€—(Hugging Face)]](https://huggingface.co/U4R/StructTable-InternVL-1B/tree/main)
17
+
18
+
19
+ </div>
20
+
21
+ Welcome to the official repository of StructEqTable-Deploy, a solution that converts images of Table into LaTeX/HTML/MarkDown, powered by scalable data from [DocGenome benchmark](https://unimodal4reasoning.github.io/DocGenome_page/).
22
+
23
+ ## Overview
24
+ Table is an effective way to represent structured data in scientific publications, financial statements, invoices, web pages, and many other scenarios. Extracting tabular data from a visual table image and performing the downstream reasoning tasks according to the extracted data is challenging, mainly due to that tables often present complicated column and row headers with spanning cell operation. To address these challenges, we present TableX, a large-scale multi-modal table benchmark extracted from [DocGenome benchmark](https://unimodal4reasoning.github.io/DocGenome_page/) for table pre-training, comprising more than 2 million high-quality Image-LaTeX pair data covering 156 disciplinary classes. Besides, benefiting from such large-scale data, we train an end-to-end model, StructEqTable, which provides the capability to precisely obtain the corresponding LaTeX description from a visual table image and perform multiple table-related reasoning tasks, including structural extraction and question answering, broadening its application scope and potential.
25
+
26
+ ## Changelog
27
+ - [2024/10/19] πŸ”₯ We have released our **latest model [StructTable-InternVL2-1B](https://huggingface.co/U4R/StructTable-InternVL-1B/tree/main)**!
28
+
29
+ Thanks to IntenrVL2 powerful foundational capabilities, and through fine-tuning on the synthetic tabular data and DocGenome dataset, StructTable can convert table image into various common table formats including LaTeX, HTML, and Markdown. Moreover, inference speed has been significantly improved compared to the v0.2 version.
30
+ - [2024/8/22] We have released our StructTable-base-v0.2, fine-tuned on the DocGenome dataset. This version features improved inference speed and robustness, achieved through data augmentation and reduced image token num.
31
+ - [2024/8/08] We have released the TensorRT accelerated version, which only takes about 1 second for most images on GPU A100. Please follow the tutorial to install the environment and compile the model weights.
32
+ - [2024/7/30] We have released the first version of StructEqTable.
33
+
34
+ ## TODO
35
+
36
+ - [x] Release inference code and checkpoints of StructEqTable.
37
+ - [x] Support Chinese version of StructEqTable.
38
+ - [x] Accelerated version of StructEqTable using TensorRT-LLM.
39
+ - [x] Expand more domains of table image to improve the model's general capabilities.
40
+ - [x] Efficient inference of StructTable-InternVL2-1B by [LMDepoly](https://github.com/InternLM/lmdeploy) Tookit.
41
+ - [ ] Release our table pre-training and fine-tuning code
42
+
43
+
44
+ ## Installation
45
+ ``` bash
46
+ conda create -n structeqtable python>=3.10
47
+ conda activate structeqtable
48
+
49
+ # Install from Source code (Suggested)
50
+ git clone https://github.com/UniModal4Reasoning/StructEqTable-Deploy.git
51
+ cd StructEqTable-Deploy
52
+ python setup develop
53
+
54
+ # or Install from Github repo
55
+ pip install "git+https://github.com/UniModal4Reasoning/StructEqTable-Deploy.git"
56
+
57
+ # or Install from PyPI
58
+ pip install struct-eqtable==0.3.0
59
+ ```
60
+
61
+ ## Model Zoo
62
+
63
+ | Model | Model Size | Training Data | Data Augmentation | LMDepoly | TensorRT | HuggingFace |
64
+ |---------------------|------------|------------------|-------------------|----------|----------|-------------------|
65
+ | StructEqTable-InternVL | ~1B | DocGenome and Synthetic Data | βœ” | βœ” | | [v0.3](https://huggingface.co/U4R/StructTable-InternVL-1B/tree/main) |
66
+ | StructEqTable-base | ~300M | DocGenome | βœ” | | βœ” | [v0.2](https://huggingface.co/U4R/StructTable-base/tree/v0.2) |
67
+ | StructEqTable-base | ~300M | DocGenome | | | βœ” | [v0.1](https://huggingface.co/U4R/StructTable-base/tree/v0.1) |
68
+
69
+
70
+
71
+ ## Quick Demo
72
+ - Run the demo/demo.py
73
+ ```shell script
74
+ cd tools/demo
75
+
76
+ python demo.py \
77
+ --image_path ./demo.png \
78
+ --ckpt_path U4R/StructTable-InternVL-1B \
79
+ --output_format latex
80
+ ```
81
+
82
+ - HTML or Markdown format output (Only Supported by StructTable-InternVL2-1B)
83
+
84
+ ```shell script
85
+ python demo.py \
86
+ --image_path ./demo.png \
87
+ --ckpt_path U4R/StructTable-InternVL-1B \
88
+ --output_format html markdown
89
+ ```
90
+
91
+ ## Efficient Inference
92
+ - Install LMDeploy Tookit
93
+ ```shell script
94
+ pip install lmdeploy
95
+ ```
96
+
97
+ - Run the demo/demo.py
98
+ ```shell script
99
+ cd tools/demo
100
+
101
+ python demo.py \
102
+ --image_path ./demo.png \
103
+ --ckpt_path U4R/StructTable-InternVL-1B \
104
+ --output_format latex \
105
+ --lmdeploy
106
+ ```
107
+
108
+
109
+ ## Acknowledgements
110
+ - [DocGenome](https://github.com/UniModal4Reasoning/DocGenome). An Open Large-scale Scientific Document Benchmark for Training and Testing Multi-modal Large Models.
111
+ - [ChartVLM](https://github.com/UniModal4Reasoning/ChartVLM). A Versatile Benchmark and Foundation Model for Complicated Chart Reasoning.
112
+ - [Pix2Struct](https://github.com/google-research/pix2struct). Screenshot Parsing as Pretraining for Visual Language Understanding.
113
+ - [InternVL Family](https://github.com/OpenGVLab/InternVL). A Series of Powerful Foundational Vision-Language Models.
114
+ - [LMDepoly](https://github.com/InternLM/lmdeploy). A toolkit for compressing, deploying, and serving LLM and MLLM.
115
+ - [UniMERNet](https://github.com/opendatalab/UniMERNet). A Universal Network for Real-World Mathematical Expression Recognition.
116
+ - [Donut](https://huggingface.co/naver-clova-ix/donut-base). The UniMERNet's Transformer Encoder-Decoder are referenced from Donut.
117
+ - [Nougat](https://github.com/facebookresearch/nougat). Data Augmentation follows Nougat.
118
+ - [TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM). Model inference acceleration uses TensorRT-LLM.
119
+
120
+
121
+ ## License
122
+ StructEqTable is released under the [Apache License 2.0](LICENSE)
123
+
124
+ ## Citation
125
+ If you find our models / code / papers useful in your research, please consider giving ⭐ and citations πŸ“, thx :)
126
+ ```bibtex
127
+ @article{xia2024docgenome,
128
+ title={DocGenome: An Open Large-scale Scientific Document Benchmark for Training and Testing Multi-modal Large Language Models},
129
+ author={Xia, Renqiu and Mao, Song and Yan, Xiangchao and Zhou, Hongbin and Zhang, Bo and Peng, Haoyang and Pi, Jiahao and Fu, Daocheng and Wu, Wenjie and Ye, Hancheng and others},
130
+ journal={arXiv preprint arXiv:2406.11633},
131
+ year={2024}
132
+ }
133
+ ```
134
+
135
+ ## Contact Us
136
+ If you encounter any issues or have questions, please feel free to contact us via zhouhongbin@pjlab.org.cn.
137
+