forked from docling-project/docling.rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCargo.toml
More file actions
73 lines (69 loc) · 3.16 KB
/
Copy pathCargo.toml
File metadata and controls
73 lines (69 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
[package]
name = "docling-pdf"
description = "PDF/image backend for docling.rs: pdfium text extraction + ONNX layout/table/OCR pipeline."
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true
readme.workspace = true
keywords.workspace = true
categories.workspace = true
rust-version.workspace = true
[features]
default = ["ml"]
# The full pipeline: pdfium page rendering + ONNX layout/OCR/TableFormer/
# enrichment. Without it only the pure-Rust text-layer path remains
# (`convert_text_layer` — lopdf content-stream parsing + the docling-parse
# line sanitizer, the same extraction `--no-ocr` uses), which compiles for
# wasm32-unknown-unknown.
# The ONNX-free OCR pre/post half (`ocr_prep`) alone — what the wasm build
# (#79 phase 2) pulls: pure Rust + the `image` crate, no ort/pdfium.
ocr-prep = ["dep:image"]
ml = [
"ocr-prep",
"dep:pdfium-render",
"dep:ort",
"dep:image",
"dep:fast_image_resize",
"dep:tokenizers",
"dep:flate2",
"dep:tar",
"dep:regex",
]
# GPU execution providers (#74). Each feature makes `ort` link/download an
# ONNX Runtime binary that contains that provider; which provider actually
# runs is chosen at startup via DOCLING_RS_EP (default: cpu). CPU stays the
# default build with zero GPU dependencies. directml is Windows-only and
# coreml is macOS-only (the underlying ONNX Runtime binaries only exist
# there); cuda/tensorrt are Linux + Windows.
# copy-dylibs rides along on every GPU feature: the CUDA/TensorRT providers
# are separate shared libraries (libonnxruntime_providers_*.so) that must sit
# next to the binary at runtime — without the copy, registration fails with a
# bare "cannot open shared object file" even on a machine with a working GPU.
cuda = ["ml", "ort/cuda", "ort/copy-dylibs"]
tensorrt = ["ml", "ort/tensorrt", "ort/copy-dylibs"]
directml = ["ml", "ort/directml", "ort/copy-dylibs"]
coreml = ["ml", "ort/coreml", "ort/copy-dylibs"]
[dependencies]
docling-core = { path = "../docling-core", version = "0.49.0" }
pdfium-render = { version = "0.8", optional = true }
ort = { version = "2.0.0-rc.12", default-features = false, features = ["std", "download-binaries", "tls-rustls"], optional = true }
image = { version = "0.25", optional = true }
flate2 = { version = "1", optional = true }
tar = { version = "0.4", optional = true }
regex = { version = "1.11", optional = true }
lopdf = "0.44"
fast_image_resize = { version = "5.1.4", optional = true }
# CodeFormula enrichment decodes its VLM output with the HF tokenizer
# (models/code_formula/tokenizer.json) — same crate/features as docling-core's
# chunking tokenizer.
tokenizers = { version = "0.20", default-features = false, features = ["onig"], optional = true }
# lopdf 0.44 compiles its PDF-encryption support unconditionally, pulling in a
# non-optional `getrandom`. On wasm32-unknown-unknown getrandom needs an
# explicit backend, so enable lopdf's `wasm_js` feature there (JS crypto) —
# the text-layer path never draws randomness, but the code must still compile.
[target.'cfg(target_arch = "wasm32")'.dependencies]
lopdf = { version = "0.44", features = ["wasm_js"] }
[lib]
name = "docling_pdf"