Datasets:
Duplicate from OleehyO/latex-formulas
Browse filesCo-authored-by: 三洋三洋 <OleehyO@users.noreply.huggingface.co>
- .gitattributes +57 -0
- README.md +121 -0
- README_zh.md +85 -0
- cleaned_formulas/train-00000-of-00006.parquet +3 -0
- cleaned_formulas/train-00001-of-00006.parquet +3 -0
- cleaned_formulas/train-00002-of-00006.parquet +3 -0
- cleaned_formulas/train-00003-of-00006.parquet +3 -0
- cleaned_formulas/train-00004-of-00006.parquet +3 -0
- cleaned_formulas/train-00005-of-00006.parquet +3 -0
- raw_formulas/train-00000-of-00001.parquet +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
# Audio files - uncompressed
|
| 38 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
# Audio files - compressed
|
| 42 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
# Image files - uncompressed
|
| 48 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
# Image files - compressed
|
| 53 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
raw_formulas.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
common_formulas.jsonl filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: openrail
|
| 3 |
+
task_categories:
|
| 4 |
+
- image-to-text
|
| 5 |
+
tags:
|
| 6 |
+
- ocr
|
| 7 |
+
- latex-ocr
|
| 8 |
+
- image2latex
|
| 9 |
+
dataset_info:
|
| 10 |
+
- config_name: cleaned_formulas
|
| 11 |
+
features:
|
| 12 |
+
- name: image
|
| 13 |
+
dtype: image
|
| 14 |
+
- name: latex_formula
|
| 15 |
+
dtype: string
|
| 16 |
+
splits:
|
| 17 |
+
- name: train
|
| 18 |
+
num_bytes: 2918992848.46
|
| 19 |
+
num_examples: 552340
|
| 20 |
+
download_size: 2778067493
|
| 21 |
+
dataset_size: 2918992848.46
|
| 22 |
+
- config_name: raw_formulas
|
| 23 |
+
features:
|
| 24 |
+
- name: latex_formula
|
| 25 |
+
dtype: string
|
| 26 |
+
splits:
|
| 27 |
+
- name: train
|
| 28 |
+
num_bytes: 240965616
|
| 29 |
+
num_examples: 1006245
|
| 30 |
+
download_size: 89507618
|
| 31 |
+
dataset_size: 240965616
|
| 32 |
+
configs:
|
| 33 |
+
- config_name: cleaned_formulas
|
| 34 |
+
data_files:
|
| 35 |
+
- split: train
|
| 36 |
+
path: cleaned_formulas/train-*
|
| 37 |
+
- config_name: raw_formulas
|
| 38 |
+
data_files:
|
| 39 |
+
- split: train
|
| 40 |
+
path: raw_formulas/train-*
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
# 𝑩𝑰𝑮 𝑵𝑬𝑾𝑺‼️
|
| 44 |
+
|
| 45 |
+
📮 [2025-08] We have updated to a larger dataset, which contains nearly 80 million samples, with significant improvements in both data quality and diversity. **[[link](https://huggingface.co/datasets/OleehyO/latex-formulas-80M)]**
|
| 46 |
+
|
| 47 |
+
📮 [2024-02] We trained a formula recognition model, [𝐓𝐞𝐱𝐓𝐞𝐥𝐥𝐞𝐫](https://github.com/OleehyO/TexTeller?tab=readme-ov-file), using the latex-formulas dataset. It can convert LaTeX formulas into images and boasts **high accuracy** and **strong generalization capabilities**, covering **most formula recognition scenarios**.
|
| 48 |
+
|
| 49 |
+
> For more details, please refer to the [𝐓𝐞𝐱𝐓𝐞𝐥𝐥𝐞𝐫 GitHub repository](https://github.com/OleehyO/TexTeller?tab=readme-ov-file).
|
| 50 |
+
|
| 51 |
+
# Dataset Description
|
| 52 |
+
> [中文版本](./README_zh.md)
|
| 53 |
+
|
| 54 |
+
There are two datasets: **raw_formulas** and **cleaned_formulas**(This dataset has **550K formula-image pairs**).
|
| 55 |
+
|
| 56 |
+
We scraped approximately 1 million LaTeX formula image-text pairs from *arxiv* that were uncleaned and without text segmentation to create the *raw_formulas* dataset. After cleaning the *raw_formulas* dataset and integrating it with the [im2latex-100K](https://zenodo.org/records/56198#.V2px0jXT6eA) dataset, we obtained the *cleaned_formulas* dataset, which has **550K** formula-image pairs.
|
| 57 |
+
|
| 58 |
+
To render the images corresponding to the formulas, the following external packages are needed:
|
| 59 |
+
* amsmath
|
| 60 |
+
* amsfonts
|
| 61 |
+
* amssymb
|
| 62 |
+
* mathtools
|
| 63 |
+
|
| 64 |
+
## Usage
|
| 65 |
+
for **raw_formulas** dataset:
|
| 66 |
+
|
| 67 |
+
```python
|
| 68 |
+
from datasets import load_dataset
|
| 69 |
+
data = load_dataset("OleehyO/latex-formulas", "raw_formulas")
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
for **cleaned_formulas** dataset:
|
| 73 |
+
```python
|
| 74 |
+
from datasets import load_dataset
|
| 75 |
+
data = load_dataset("OleehyO/latex-formulas", "cleaned_formulas")
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
## Details About the *raw_formulas* Dataset
|
| 79 |
+
We scraped LaTeX formulas containing the following environments:
|
| 80 |
+
* equation
|
| 81 |
+
* align
|
| 82 |
+
* align*
|
| 83 |
+
* gather
|
| 84 |
+
* gather*
|
| 85 |
+
|
| 86 |
+
The formulas do not include the following content:
|
| 87 |
+
* \label
|
| 88 |
+
* %
|
| 89 |
+
* \quad
|
| 90 |
+
* \qquad
|
| 91 |
+
* \vspace
|
| 92 |
+
* \hspace
|
| 93 |
+
* \resizebox
|
| 94 |
+
* \scalebox
|
| 95 |
+
* \rotatebox
|
| 96 |
+
* \parbox
|
| 97 |
+
* \fbox
|
| 98 |
+
* \makebox
|
| 99 |
+
* \raisebox
|
| 100 |
+
* \addvspace
|
| 101 |
+
* \hfill
|
| 102 |
+
* \vfill
|
| 103 |
+
* \textwidth
|
| 104 |
+
* \textheight
|
| 105 |
+
* \rule
|
| 106 |
+
|
| 107 |
+
## Preprocessing Details of the *cleaned_formulas* Dataset
|
| 108 |
+
### Cleaning
|
| 109 |
+
* We removed some useless junk data from both *raw_formulas* and [im2latex-100K](https://zenodo.org/records/56198#.V2px0jXT6eA).
|
| 110 |
+
* We deleted overly complex formulas from both *raw_formulas* and [im2latex-100K](https://zenodo.org/records/56198#.V2px0jXT6eA):
|
| 111 |
+
* Formulas were deleted if the aspect ratio of the corresponding rendered image was greater than 0.8.
|
| 112 |
+
* Formulas with a character length greater than 200 were deleted.
|
| 113 |
+
* In the formulas from both *raw_formulas* and [im2latex-100K](https://zenodo.org/records/56198#.V2px0jXT6eA), the following content was removed:
|
| 114 |
+
* \tag
|
| 115 |
+
* \text
|
| 116 |
+
* \begin{split}
|
| 117 |
+
* \end{split}
|
| 118 |
+
* \nonumber
|
| 119 |
+
* \notag
|
| 120 |
+
* The `equation`, `equation*`, `align`, `\[...\]` environments in *raw_formulas* were all replaced with the `align*` environment.
|
| 121 |
+
* We deleted formulas from *raw_formulas* that contained custom macros.
|
README_zh.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: openrail
|
| 3 |
+
task_categories:
|
| 4 |
+
- image-to-text
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# 大新闻‼️
|
| 8 |
+
|
| 9 |
+
📮 [2025-08] 我们更新了一个更大的数据集,包含了将近80M个样本,并且数据质量和数据多样性有了显著的提升。 **[[link](https://huggingface.co/datasets/OleehyO/latex-formulas-80M)]**
|
| 10 |
+
|
| 11 |
+
📮 [2024-02] 我们使用latex-formulas数据集训练了一个公式识别模型[TexTeller](https://github.com/OleehyO/TexTeller?tab=readme-ov-file),它可以将latex公式转换为图片,并且有着**很高的准确率**以及**很强的泛化能力**,可以**覆盖大部分公式识别场景**。
|
| 12 |
+
|
| 13 |
+
> 详情信息请参阅[TexTeller的github仓库](https://github.com/OleehyO/TexTeller?tab=readme-ov-file)
|
| 14 |
+
|
| 15 |
+
# Dataset Description
|
| 16 |
+
|
| 17 |
+
这里有两个数据集:**raw_formulas**和**cleaned_formulas**(这个数据集有*550K*个公式-图片对)。
|
| 18 |
+
|
| 19 |
+
我们在*arxiv*上爬取了约100万条未经过清洗以及文本分词的latex公式的图片文本对从而得到了*raw_formulas*数据集。
|
| 20 |
+
在将*raw_formulas*数据集进行**清洗**并加入[im2latex-100K](https://zenodo.org/records/56198#.V2px0jXT6eA)数据集后得到了*cleaned_formulas*数据集(一个具有*550K*公式-图片对的数据集)。
|
| 21 |
+
|
| 22 |
+
渲染公式对应的图片时,需要用到以下外部包:
|
| 23 |
+
* amsmath
|
| 24 |
+
* amsfonts
|
| 25 |
+
* amssymb
|
| 26 |
+
* mathtools
|
| 27 |
+
|
| 28 |
+
## 用法
|
| 29 |
+
加载 **raw_formulas** 数据集:
|
| 30 |
+
|
| 31 |
+
```python
|
| 32 |
+
from datasets import load_dataset
|
| 33 |
+
data = load_dataset("OleehyO/latex-formulas", "raw_formulas")
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
加载 **cleaned_formulas** 数据集:
|
| 37 |
+
```python
|
| 38 |
+
from datasets import load_dataset
|
| 39 |
+
data = load_dataset("OleehyO/latex-formulas", "cleaned_formulas")
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## 有关*raw_formulas*数据集的一些细节
|
| 43 |
+
我们爬取了包含以下公式环境的latex公式:
|
| 44 |
+
* equation
|
| 45 |
+
* align
|
| 46 |
+
* align*
|
| 47 |
+
* gather
|
| 48 |
+
* gather*
|
| 49 |
+
|
| 50 |
+
公式中不存在以下内容:
|
| 51 |
+
* \label
|
| 52 |
+
* %
|
| 53 |
+
* \quad
|
| 54 |
+
* \qquad
|
| 55 |
+
* \vspace
|
| 56 |
+
* \hspace
|
| 57 |
+
* \resizebox
|
| 58 |
+
* \scalebox
|
| 59 |
+
* \rotatebox
|
| 60 |
+
* \parbox
|
| 61 |
+
* \fbox
|
| 62 |
+
* \makebox
|
| 63 |
+
* \raisebox
|
| 64 |
+
* \addvspace
|
| 65 |
+
* \hfill
|
| 66 |
+
* \vfill
|
| 67 |
+
* \textwidth
|
| 68 |
+
* \textheight
|
| 69 |
+
* \rule
|
| 70 |
+
|
| 71 |
+
## *cleaned_formulas*数据集的一些预处理细节
|
| 72 |
+
### 清洗
|
| 73 |
+
* 我们删除了*raw_formulas*和[im2latex-100K](https://zenodo.org/records/56198#.V2px0jXT6eA)中一些无用的垃圾数据
|
| 74 |
+
* 我们删除了*raw_formulas*和[im2latex-100K](https://zenodo.org/records/56198#.V2px0jXT6eA)中过于复杂的公式:
|
| 75 |
+
* 公式对应的渲染图片高宽比如果大于0.8,那么公式会被删除
|
| 76 |
+
* 字符长度大于200的公式被删除了
|
| 77 |
+
* 在*raw_formulas*和[im2latex-100K](https://zenodo.org/records/56198#.V2px0jXT6eA)的公式中,以下内容被删除了:
|
| 78 |
+
* \tag
|
| 79 |
+
* \text
|
| 80 |
+
* \begin{split}
|
| 81 |
+
* \end{split}
|
| 82 |
+
* \nonumber
|
| 83 |
+
* \notag
|
| 84 |
+
* *raw_formulas*和中的`equation、equation*、align、\[...\]`公式环境均被替换成了`align*`公式环境
|
| 85 |
+
* 我们删除了*raw_formulas*中包含自定义宏的公式。
|
cleaned_formulas/train-00000-of-00006.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a82ed31fc852c691cc5a853e2a0c42eacf95d64f410b5c0d29e4e26e6c049ace
|
| 3 |
+
size 467962105
|
cleaned_formulas/train-00001-of-00006.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1b502509a370eb42bf73260136fd1cdeeb369fd38b859fc9fc4ef0ccd0fb1b62
|
| 3 |
+
size 452927050
|
cleaned_formulas/train-00002-of-00006.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5bf5e047a988c85dc2c5559079273c1208c022900367b16b07e74f56763479ff
|
| 3 |
+
size 438939128
|
cleaned_formulas/train-00003-of-00006.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c624c202255c372c38ba9b813d74fd540c76fd659eb172f46a28ff6d4413d4d6
|
| 3 |
+
size 476637419
|
cleaned_formulas/train-00004-of-00006.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6ea143ae18e3de417d62de06674bfd1ec84563615e4e25b073a066752c815739
|
| 3 |
+
size 471369030
|
cleaned_formulas/train-00005-of-00006.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5ba4fbf0eccdad785124f96ae8337180903d532e6990fe01f54269034003d7b7
|
| 3 |
+
size 470232761
|
raw_formulas/train-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:79082715e51aa7d231909d5fcffd83c8997d792399832f654f88e6b8914af47b
|
| 3 |
+
size 89507618
|