1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 poetry-core,
8
9 # dependencies
10 accelerate,
11 docling-core,
12 huggingface-hub,
13 jsonlines,
14 numpy,
15 opencv-python-headless,
16 pillow,
17 pydantic,
18 rtree,
19 safetensors,
20 torch,
21 torchvision,
22 tqdm,
23 transformers,
24
25 # tests
26 datasets,
27 pytestCheckHook,
28 writableTmpDirAsHomeHook,
29}:
30
31buildPythonPackage rec {
32 pname = "docling-ibm-models";
33 version = "3.9.1";
34 pyproject = true;
35
36 src = fetchFromGitHub {
37 owner = "docling-project";
38 repo = "docling-ibm-models";
39 tag = "v${version}";
40 hash = "sha256-2yoXV6iE9AGjdfQtOSqoMWlNtTM2ueL+cl5IcCHguDg=";
41 };
42
43 build-system = [
44 poetry-core
45 ];
46
47 dependencies = [
48 accelerate
49 docling-core
50 huggingface-hub
51 jsonlines
52 numpy
53 opencv-python-headless
54 pillow
55 pydantic
56 rtree
57 safetensors
58 torch
59 torchvision
60 tqdm
61 transformers
62 ];
63
64 pythonRelaxDeps = [
65 "jsonlines"
66 "numpy"
67 "transformers"
68 ];
69
70 pythonImportsCheck = [
71 "docling_ibm_models"
72 ];
73
74 nativeCheckInputs = [
75 datasets
76 pytestCheckHook
77 writableTmpDirAsHomeHook
78 ];
79
80 disabledTests = [
81 # Requires network access
82 "test_code_formula_predictor" # huggingface_hub.errors.LocalEntryNotFoundError
83 "test_figure_classifier" # huggingface_hub.errors.LocalEntryNotFoundError
84 "test_layoutpredictor"
85 "test_readingorder"
86 "test_tf_predictor"
87 ];
88
89 meta = {
90 changelog = "https://github.com/DS4SD/docling-ibm-models/blob/${src.tag}/CHANGELOG.md";
91 description = "Docling IBM models";
92 homepage = "https://github.com/DS4SD/docling-ibm-models";
93 license = lib.licenses.mit;
94 maintainers = with lib.maintainers; [ ];
95 };
96}