1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pythonOlder,
7 setuptools,
8 pytestCheckHook,
9 pytest-xdist,
10 torchvision,
11 matplotlib,
12 mock,
13 packaging,
14 torch,
15}:
16
17buildPythonPackage rec {
18 pname = "ignite";
19 version = "0.5.2";
20 pyproject = true;
21
22 disabled = pythonOlder "3.8";
23
24 src = fetchFromGitHub {
25 owner = "pytorch";
26 repo = "ignite";
27 tag = "v${version}";
28 hash = "sha256-aWm+rj/9A7oNBW5jkMg/BRuEw2gQUJ88At1wB75FgNQ=";
29 };
30
31 build-system = [ setuptools ];
32
33 dependencies = [
34 packaging
35 torch
36 ];
37
38 nativeCheckInputs = [
39 pytestCheckHook
40 matplotlib
41 mock
42 pytest-xdist
43 torchvision
44 ];
45
46 # runs successfully in 3.9, however, async isn't correctly closed so it will fail after test suite.
47 doCheck = pythonOlder "3.9";
48
49 enabledTestPaths = [
50 "tests/"
51 ];
52
53 # Some packages are not in NixPkgs; other tests try to build distributed
54 # models, which doesn't work in the sandbox.
55 # avoid tests which need special packages
56 disabledTestPaths = [
57 "tests/ignite/contrib/handlers/test_clearml_logger.py"
58 "tests/ignite/contrib/handlers/test_lr_finder.py"
59 "tests/ignite/contrib/handlers/test_trains_logger.py"
60 "tests/ignite/metrics/nlp/test_bleu.py"
61 "tests/ignite/metrics/nlp/test_rouge.py"
62 "tests/ignite/metrics/gan" # requires pytorch_fid; tries to download model to $HOME
63 "tests/ignite/metrics/test_dill.py"
64 "tests/ignite/metrics/test_psnr.py"
65 "tests/ignite/metrics/test_ssim.py"
66 ];
67
68 # disable tests which need specific packages
69 disabledTests = [
70 "idist"
71 "mlflow"
72 "tensorboard"
73 "test_gpu_info" # needs pynvml
74 "test_integration"
75 "test_output_handler" # needs mlflow
76 "test_pbar" # slight output differences
77 "test_setup_clearml_logging"
78 "test_setup_neptune"
79 "test_setup_plx"
80 "test_write_results"
81 "trains"
82 "visdom"
83 ];
84
85 pythonImportsCheck = [
86 "ignite"
87 "ignite.engine"
88 "ignite.handlers"
89 "ignite.metrics"
90 "ignite.distributed"
91 "ignite.exceptions"
92 "ignite.utils"
93 "ignite.contrib"
94 ];
95
96 meta = {
97 description = "High-level training library for PyTorch";
98 homepage = "https://pytorch-ignite.ai";
99 changelog = "https://github.com/pytorch/ignite/releases/tag/${src.tag}";
100 license = lib.licenses.bsd3;
101 maintainers = [ lib.maintainers.bcdarwin ];
102 };
103}