fullerene-data / scripts /sources.py
Karan2599's picture
The training set's and 41 benchmarks' manifests, and the data report
35a8678 verified
Raw History Blame Contribute Delete
17.3 kB
"""The phase 1 data sources, declared once.
Every entry says where the data comes from, which slice phase 1 takes, its
license as the original source states it, and what it may be used for:
T may train weights that are shipped, once the license is confirmed
R research or non-commercial only: evaluation and ablations, never shipped weights
E evaluation set: never trained or tuned on
`fetch.py` downloads these, `profile.py` measures them, `report.py` compares
them with what the reference engines trained on.
"""
LATIN_WIKI = ("de", "fr", "es", "it", "pt", "nl", "pl", "cs", "tr", "vi")
FW2_LANGS = ("deu_Latn", "fra_Latn", "spa_Latn", "ita_Latn", "por_Latn", "nld_Latn", "pol_Latn",
"ces_Latn", "tur_Latn", "vie_Latn")
FINEPDFS_LANGS = ("eng_Latn", "deu_Latn", "fra_Latn", "spa_Latn")
GB = 1024 ** 3
MB = 1024 ** 2
SOURCES = [
# ------------------------------------------------------------ fonts, text
dict(name="fonts-google", group="fonts", kind="git", use="T",
url="https://github.com/google/fonts.git",
license="OFL 1.1 / Apache 2.0 / UFL (per family)", license_url="https://github.com/google/fonts#license",
expected_bytes=int(3.2 * GB), datasets_md="3"),
dict(name="fonts-noto", group="fonts", kind="git", use="T",
url="https://github.com/notofonts/notofonts.github.io.git",
license="OFL 1.1", license_url="https://notofonts.github.io/",
expected_bytes=int(1.5 * GB), datasets_md="3"),
dict(name="langdata-lstm", group="text", kind="git", use="T",
url="https://github.com/tesseract-ocr/langdata_lstm.git",
license="Apache 2.0", license_url="https://github.com/tesseract-ocr/langdata_lstm/blob/main/LICENSE",
expected_bytes=int(1.2 * GB), datasets_md="2"),
dict(name="wikipedia", group="text", kind="hf", use="T", repo="wikimedia/wikipedia",
files=["20231101.en/train-00000-of-00041.parquet", "20231101.en/train-00001-of-00041.parquet"]
+ [f"20231101.{l}/train-00000-of-{n}.parquet" for l, n in
zip(LATIN_WIKI, ("00020", "00017", "00013", "00010", "00006", "00006", "00006", "00004",
"00002", "00004"))],
license="CC BY-SA 4.0 (and GFDL)", license_url="https://dumps.wikimedia.org/legal.html",
expected_bytes=int(5.6 * GB), datasets_md="2"),
dict(name="fineweb-2", group="text", kind="hf_rowgroups", use="T", repo="HuggingFaceFW/fineweb-2",
files=[f"data/{l}/train/000_00000.parquet" for l in FW2_LANGS], budget_bytes=200 * MB,
columns=["text", "id", "url", "language"],
license="ODC-By 1.0", license_url="https://huggingface.co/datasets/HuggingFaceFW/fineweb-2",
expected_bytes=int(2.0 * GB), datasets_md="2"),
dict(name="finepdfs", group="text", kind="hf_rowgroups", use="T", repo="HuggingFaceFW/finepdfs",
files=[f"data/{l}/train/000_00000.parquet" for l in FINEPDFS_LANGS], budget_bytes=500 * MB,
columns=["text", "id", "url", "language"],
license="ODC-By 1.0", license_url="https://huggingface.co/datasets/HuggingFaceFW/finepdfs",
expected_bytes=int(2.0 * GB), datasets_md="2"),
# ------------------------------------------------------------- synthetic
dict(name="nvidia-ocr-synthetic", group="synthetic", kind="hf_budget", use="T",
repo="nvidia/OCR-Synthetic-Multilingual-v1", prefixes=["en/train/", "ru/train/"],
budget_bytes=25 * GB, # per prefix
license="CC BY 4.0", license_url="https://huggingface.co/datasets/nvidia/OCR-Synthetic-Multilingual-v1",
expected_bytes=50 * GB, datasets_md="1, 4"),
# -------------------------------------------------------- real, labeled
dict(name="doclaynet", group="layout", kind="hf", use="T", repo="docling-project/DocLayNet-v1.2",
license="CDLA-Permissive-1.0", license_url="https://github.com/DS4SD/DocLayNet",
expected_bytes=37 * GB, datasets_md="6"),
dict(name="hiertext", group="text-in-images", kind="http", use="T",
urls=["https://open-images-dataset.s3.amazonaws.com/ocr/train.tgz",
"https://open-images-dataset.s3.amazonaws.com/ocr/validation.tgz",
"https://open-images-dataset.s3.amazonaws.com/ocr/test.tgz",
"https://raw.githubusercontent.com/google-research-datasets/hiertext/main/gt/train.jsonl.gz",
"https://raw.githubusercontent.com/google-research-datasets/hiertext/main/gt/validation.jsonl.gz",
"https://raw.githubusercontent.com/google-research-datasets/hiertext/main/gt/test.jsonl.gz"],
license="CC BY-SA 4.0 (annotations); images CC BY 2.0 (Open Images)",
license_url="https://github.com/google-research-datasets/hiertext",
expected_bytes=int(3.8 * GB), datasets_md="8"),
dict(name="textocr", group="text-in-images", kind="http", use="T",
urls=["https://dl.fbaipublicfiles.com/textvqa/images/train_val_images.zip",
"https://dl.fbaipublicfiles.com/textvqa/data/textocr/TextOCR_0.1_train.json",
"https://dl.fbaipublicfiles.com/textvqa/data/textocr/TextOCR_0.1_val.json"],
license="CC BY 4.0 (annotations); images CC BY 2.0 (Open Images)", license_url="https://textvqa.org/textocr/",
expected_bytes=int(7.0 * GB), datasets_md="8"),
dict(name="gt4histocr", group="historical", kind="zenodo", use="T", record="1344132",
license="CC BY 4.0", license_url="https://zenodo.org/records/1344132",
expected_bytes=int(3.8 * GB), datasets_md="11"),
dict(name="gnhk", group="handwriting", kind="hf", use="T", repo="radhakrishnadeshpande/gnhk-pagelevel",
license="CC BY 4.0 (GNHK; this is a mirror)", license_url="https://www.goodnotes.com/gnhk",
expected_bytes=int(1.0 * GB), datasets_md="10"),
# ---------------------------------------------------------- born-digital
dict(name="govdocs1", group="born-digital", kind="hf", use="T", repo="BEE-spoke-data/govdocs1-pdf-source",
files=["data/data_pdfs_part.tar.aa"], # the first piece of one split tar: readable as a stream
license="card: CC BY 4.0 (US government files; check)",
license_url="https://digitalcorpora.org/corpora/file-corpora/files/",
expected_bytes=10 * GB, datasets_md="5"),
# Original PDFs (SafeDocs, Common Crawl) with word and line boxes taken from
# their own text layers: the born-digital label scheme.
dict(name="pdfa-eng", group="born-digital", kind="hf", use="check", repo="pixparse/pdfa-eng-wds",
files=[f"pdfa-eng-train-{i:04d}.tar" for i in range(12)],
license="other (Common Crawl and Digital Corpora terms; per document copyright)",
license_url="https://huggingface.co/datasets/pixparse/pdfa-eng-wds",
expected_bytes=int(9.4 * GB), datasets_md="1, 5"),
dict(name="pmc-oa", group="born-digital", kind="pmc", use="T", budget_bytes=10 * GB,
licenses=["CC0", "CC BY", "CC BY-SA", "CC BY-ND"],
license="CC0 / CC BY / CC BY-SA / CC BY-ND per article", license_url="https://registry.opendata.aws/ncbi-pmc/",
expected_bytes=10 * GB, datasets_md="5"),
dict(name="arxiv", group="born-digital", kind="arxiv", use="T", count=1000, oai_set="cs",
oai_from="2024-01-01",
licenses=["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/publicdomain/zero/1.0/",
"http://creativecommons.org/licenses/by-sa/4.0/"],
license="CC BY 4.0 / CC0 / CC BY-SA 4.0 per paper", license_url="https://info.arxiv.org/help/license/",
expected_bytes=int(2.5 * GB), datasets_md="5"),
# ------------------------------------------------------------ evaluation
dict(name="omni-parse-bench", group="eval", kind="hf", use="E", repo="datalab-to/omni_parse_bench",
license="other (see the card)", license_url="https://huggingface.co/datasets/datalab-to/omni_parse_bench",
expected_bytes=int(1.4 * GB), datasets_md="14"),
dict(name="omnidocbench", group="eval", kind="hf", use="E", repo="opendatalab/OmniDocBench",
license="check", license_url="https://huggingface.co/datasets/opendatalab/OmniDocBench",
expected_bytes=int(3.1 * GB), datasets_md="14"),
dict(name="olmocr-bench", group="eval", kind="hf", use="E", repo="allenai/olmOCR-bench",
license="ODC-By", license_url="https://huggingface.co/datasets/allenai/olmOCR-bench",
expected_bytes=int(0.4 * GB), datasets_md="14"),
dict(name="iam-line", group="eval", kind="hf", use="E", repo="Teklia/IAM-line",
license="IAM: non-commercial research (the mirror's card says MIT)",
license_url="https://fki.tic.heia-fr.ch/databases/iam-handwriting-database",
expected_bytes=int(2.0 * GB), datasets_md="10"),
dict(name="funsd", group="eval", kind="hf", use="E", repo="nielsr/funsd",
license="non-commercial research", license_url="https://guillaumejaume.github.io/FUNSD/",
expected_bytes=16 * MB, datasets_md="9"),
]
BY_NAME = {s["name"]: s for s in SOURCES}
# ---------------------------------------------------------------- the benchmarks
# The page-parsing benchmarks and the per-language sets, beyond the five
# phase 1 fetched; all evaluation only (E). `python data/fetch.py --set bench` puts them in
# <root>/bench/<name>. Not fetched: ivrit-ai/hebrew-handwriting-ocr-benchmark (gated: its
# terms are accepted with an account). Licenses marked "card:" are the Hugging Face card's.
# KITAB-Bench without its VQA sets: subset -> MB on the Hub
KITAB_SUBSETS = dict(khatt=10, khattparagraph=50, onlinekhatt=10, synthesizear=10, patsocr=10, historyar=170,
historicalbooks=5, adab=5, muharaf=10, isippt=5, arabicocr=5, hindawi=10, evarest=5, ourslines=90,
bcelayout=640, doclaynet=150, doclaynetv2=150, tables=100, charts=280, diagrams=30)
OCR_BENCH_1000 = ("Hindi", "Bengali", "Tamil", "Telugu", "Kannada", "Malayalam", "Marathi", "Gujarati", "Punjabi",
"Sanskrit")
def _bench(name, repo, license, size, md="14", **kw):
return dict(name=name, group="bench", kind="hf", use="E", repo=repo, license=license,
license_url=f"https://huggingface.co/datasets/{repo}", expected_bytes=int(size), datasets_md=md, **kw)
BENCH = [
# pages: parsing, OCR, layout, tables
_bench("real5-omnidocbench", "PaddlePaddle/Real5-OmniDocBench", "card: Apache 2.0", 15.7 * GB),
_bench("olmocr-bench-1.5", "allenai/olmOCR-bench-1.5-preview", "ODC-By", 0.55 * GB),
_bench("omni-ai-ocr", "getomni-ai/ocr-benchmark", "card: MIT", 3.4 * GB),
_bench("docling-dpbench", "docling-project/docling-dpbench", "Apache 2.0", 0.25 * GB),
_bench("fox", "ucaslcl/Fox_benchmark_data", "CC BY-NC-SA 4.0", 0.65 * GB),
_bench("icdar2013-tables", "bsmock/ICDAR-2013-Table-Competition-Corrected", "CDLA-Permissive-2.0", 12 * MB),
# text in mixed images
_bench("ocrbench", "echo840/OCRBench", "check", 0.15 * GB),
_bench("ocrbench-v2", "ling99/OCRBench_v2", "card: MIT", 0.95 * GB),
_bench("cc-ocr", "wulipc/CC-OCR", "card: MIT", 4.2 * GB),
_bench("cc-ocr-v2", "Eioss/CC-OCR-V2", "card: MIT", 3.9 * GB),
# forms and receipts (section 9): their test sets as benchmarks
_bench("cord-v2-test", "naver-clova-ix/cord-v2", "CC BY 4.0", 0.5 * GB, md="9",
patterns=["README.md", "data/test-*", "data/validation-*"]),
_bench("sroie", "jsdnrs/ICDAR2019-SROIE", "research (card: CC BY 4.0)", 0.5 * GB, md="9"),
_bench("xfund", "nnul/xfund-multilingual", "check (likely non-commercial)", 1.25 * GB, md="9"),
# math (section 13): the test set only
_bench("unimer-test", "wanderkid/UniMER_Dataset", "card: Apache 2.0", 0.15 * GB, md="13",
files=["README.md", "UniMER-Test.zip"]),
# per language (sections 10 and 12)
_bench("thai-ocrbench", "typhoon-ai/ThaiOCRBench", "CC BY-SA 4.0", 1.8 * GB, md="12"),
_bench("thai-ocr-evaluation", "openthaigpt/thai-ocr-evaluation", "CC BY-SA 4.0", 10 * MB, md="12"),
_bench("chinese-ocrbench", "SWHL/ChineseOCRBench", "card: Apache 2.0", 3.8 * GB, md="12"),
_bench("tamil-ocr-benchmark", "mvbalaji/tamil-ocr-benchmark", "card: CC BY 4.0", 13 * MB, md="12"),
_bench("hebrew-doc-ocr", "AmitKabya/hebrew-doc-ocr-benchmark", "check", 2 * MB, md="12"),
_bench("persian-ocr-double", "Reza2kn/persian-ocr-double-benchmark", "check", 2.2 * GB, md="10"),
_bench("persian-ocr-benchmark", "PersianML/persian-ocr-benchmark", "other (see the card)", 20 * MB, md="12"),
*[_bench(f"kitab-{s}", f"ahmedheakl/arocrbench_{s}", "check (card: MIT for khatt)", mb * MB, md="12")
for s, mb in KITAB_SUBSETS.items()],
*[_bench(f"ocr-bench-1000-{lang.lower()}", f"meharuhanzz/OCR-Bench1000-{lang}", "card: MIT", 25 * MB, md="12")
for lang in OCR_BENCH_1000],
]
# ------------------------------------------------------------ phase 3, on top of phase 1
# about 500 GB, each set with its converter (data/convert.py for
# PubTables-1M and NVIDIA's, carbon-convert for the rest). PubTables-1M: the pages, their words
# and the tables in PDF points, not its table crops.
PUBTABLES = "PubTables-1M-"
CHRONAM = "RevolutionCrossroads/loc_chronicling_america_1770-1810"
PHASE3 = [
dict(name="pubtables-1m", group="tables", kind="hf", use="T", repo="bsmock/pubtables-1m",
files=[f"{PUBTABLES}Detection_Images_{part}.tar.gz" for part in ("Train_Part1", "Train_Part2", "Val", "Test")]
+ [f"{PUBTABLES}Detection_Page_Words.tar.gz", f"{PUBTABLES}PDF_Annotations.tar.gz"],
license="CDLA-Permissive-2.0", license_url="https://huggingface.co/datasets/bsmock/pubtables-1m",
expected_bytes=81 * GB, datasets_md="7"),
# NVIDIA's English pages past phase 1's two shards: their reading-order graphs (convert.py nvidia-more)
dict(name="nvidia-ocr-synthetic-more", group="synthetic", kind="hf_budget", use="T",
repo="nvidia/OCR-Synthetic-Multilingual-v1", prefixes=["en/train/"], skip_bytes=25 * GB,
budget_bytes=220 * GB, license="CC BY 4.0",
license_url="https://huggingface.co/datasets/nvidia/OCR-Synthetic-Multilingual-v1",
expected_bytes=220 * GB, datasets_md="4"),
# IBM's own download is gone; this copy keeps the COCO annotations (polygons too) in Parquet
dict(name="publaynet", group="layout", kind="hf", use="T", repo="jordanparker6/publaynet",
patterns=["data/train-*.parquet", "data/validation-*.parquet"], license="CDLA-Permissive-1.0",
license_url="https://github.com/ibm-aur-nlp/PubLayNet", expected_bytes=104 * GB, datasets_md="6"),
dict(name="fintabnet-c", group="tables", kind="hf", use="T", repo="bsmock/FinTabNet.c",
files=["FinTabNet.c-Structure.tar.gz"], license="CDLA-Permissive-2.0",
license_url="https://huggingface.co/datasets/bsmock/FinTabNet.c", expected_bytes=3 * GB, datasets_md="7"),
# its train and validation splits; the test split is the benchmark's (--set bench)
dict(name="cord-v2", group="receipts", kind="hf", use="T", repo="naver-clova-ix/cord-v2",
patterns=["data/train-*.parquet", "data/validation-*.parquet"], license="CC BY 4.0",
license_url="https://huggingface.co/datasets/naver-clova-ix/cord-v2", expected_bytes=2 * GB,
datasets_md="9"),
# 40 GB of its 195 GB of page PDFs, titles and years mixed, each with its ALTO (about 10 GB)
dict(name="chronicling-america", group="historical", kind="hf_budget", use="T", repo=CHRONAM,
prefixes=["media/"], order="hash", budget_bytes=40 * GB,
companion=dict(prefix="ocr_alto_xml/", pattern=r"^media/([^/]+)/(.+)\.pdf$",
replace=r"ocr_alto_xml/\1/\1_\2.xml"),
license="CC0", license_url=f"https://huggingface.co/datasets/{CHRONAM}", expected_bytes=50 * GB,
datasets_md="11"),
# agency publications, born digital and mostly tagged: their structure trees' reading order
dict(name="govinfo-tagged", group="born-digital", kind="govinfo", use="T", collection="GOVPUB",
years=list(range(2015, 2027)), budget_bytes=40 * GB, license="public domain (US federal works)",
license_url="https://www.govinfo.gov/about/policies", expected_bytes=40 * GB, datasets_md="5"),
]
# Phase 3's sets whose license is still to be confirmed: fetched only on purpose.
PHASE3_CHECK = [
dict(name="docbank", group="layout", kind="hf", use="check", repo="liminghao1630/DocBank",
files=[f"DocBank_500K_ori_img.zip.{k:03d}" for k in range(1, 11)]
+ ["DocBank_500K_txt.zip", "MSCOCO_Format_Annotation.zip"],
license="check: apache-2.0 on its card; CC BY-NC-ND 4.0 in its annotation files; its GitHub asks that "
"it not be redistributed", license_url="https://github.com/doc-analysis/DocBank",
expected_bytes=54 * GB, datasets_md="6"),
]
SETS = {"phase1": SOURCES, "phase3": PHASE3, "phase3-check": PHASE3_CHECK, "bench": BENCH}