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 = pname;
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 # Some packages are not in NixPkgs; other tests try to build distributed
50 # models, which doesn't work in the sandbox.
51 # avoid tests which need special packages
52 pytestFlagsArray = [
53 "--ignore=tests/ignite/contrib/handlers/test_clearml_logger.py"
54 "--ignore=tests/ignite/contrib/handlers/test_lr_finder.py"
55 "--ignore=tests/ignite/contrib/handlers/test_trains_logger.py"
56 "--ignore=tests/ignite/metrics/nlp/test_bleu.py"
57 "--ignore=tests/ignite/metrics/nlp/test_rouge.py"
58 "--ignore=tests/ignite/metrics/gan" # requires pytorch_fid; tries to download model to $HOME
59 "--ignore=tests/ignite/metrics/test_dill.py"
60 "--ignore=tests/ignite/metrics/test_psnr.py"
61 "--ignore=tests/ignite/metrics/test_ssim.py"
62 "tests/"
63 ];
64
65 # disable tests which need specific packages
66 disabledTests = [
67 "idist"
68 "mlflow"
69 "tensorboard"
70 "test_gpu_info" # needs pynvml
71 "test_integration"
72 "test_output_handler" # needs mlflow
73 "test_pbar" # slight output differences
74 "test_setup_clearml_logging"
75 "test_setup_neptune"
76 "test_setup_plx"
77 "test_write_results"
78 "trains"
79 "visdom"
80 ];
81
82 pythonImportsCheck = [
83 "ignite"
84 "ignite.engine"
85 "ignite.handlers"
86 "ignite.metrics"
87 "ignite.distributed"
88 "ignite.exceptions"
89 "ignite.utils"
90 "ignite.contrib"
91 ];
92
93 meta = {
94 description = "High-level training library for PyTorch";
95 homepage = "https://pytorch-ignite.ai";
96 changelog = "https://github.com/pytorch/ignite/releases/tag/${src.tag}";
97 license = lib.licenses.bsd3;
98 maintainers = [ lib.maintainers.bcdarwin ];
99 };
100}