Files
nixpkgs/pkgs/development/python-modules/docling-ibm-models/default.nix
T
Ihar Hrachyshka 65b802a6fd python312Packages.torch: build torch.distributed on darwin
It's disabled on MacOS by default:
https://pytorch.org/docs/stable/distributed.html#torch.distributed.is_available

When distributed module build is enabled, a compilation error happens on
fresh clang.

Upstream repo (which is a submodule in pytorch) is archived so it's
impossible to contribute the fix there. Instead, an inline patch is
included that is enough to fix the error.

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
2025-04-01 21:23:51 -04:00

94 lines
1.7 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
# build-system
poetry-core,
# dependencies
docling-core,
huggingface-hub,
jsonlines,
numpy,
opencv-python-headless,
pillow,
pydantic,
safetensors,
torch,
torchvision,
tqdm,
transformers,
# tests
datasets,
pytestCheckHook,
writableTmpDirAsHomeHook,
}:
buildPythonPackage rec {
pname = "docling-ibm-models";
version = "3.4.1";
pyproject = true;
src = fetchFromGitHub {
owner = "docling-project";
repo = "docling-ibm-models";
tag = "v${version}";
hash = "sha256-IgKP+4en0N6xLBjzwmddDk8z5P3J1vo+UMW+65a01Ww=";
};
build-system = [
poetry-core
];
dependencies = [
docling-core
huggingface-hub
jsonlines
numpy
opencv-python-headless
pillow
pydantic
safetensors
torch
torchvision
tqdm
transformers
];
pythonRelaxDeps = [
"jsonlines"
"numpy"
"transformers"
];
pythonImportsCheck = [
"docling_ibm_models"
];
nativeCheckInputs = [
datasets
pytestCheckHook
writableTmpDirAsHomeHook
];
disabledTests = [
# Requires network access
"test_code_formula_predictor" # huggingface_hub.errors.LocalEntryNotFoundError
"test_figure_classifier" # huggingface_hub.errors.LocalEntryNotFoundError
"test_layoutpredictor"
"test_readingorder"
"test_tf_predictor"
];
meta = {
changelog = "https://github.com/DS4SD/docling-ibm-models/blob/${src.tag}/CHANGELOG.md";
description = "Docling IBM models";
homepage = "https://github.com/DS4SD/docling-ibm-models";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ drupol ];
};
}