1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 pytest-xdist,
7 torchvision,
8 pythonOlder,
9 matplotlib,
10 mock,
11 packaging,
12 torch,
13 scikit-learn,
14 tqdm,
15}:
16
17buildPythonPackage rec {
18 pname = "ignite";
19 version = "0.5.0.post2";
20 format = "setuptools";
21
22 src = fetchFromGitHub {
23 owner = "pytorch";
24 repo = pname;
25 rev = "refs/tags/v${version}";
26 hash = "sha256-Lg7ASODYwWWhC45X4+Bk50gSlSWwgn2tM4atLXWbQLI=";
27 };
28
29 nativeCheckInputs = [
30 pytestCheckHook
31 matplotlib
32 mock
33 pytest-xdist
34 torchvision
35 ];
36 propagatedBuildInputs = [
37 packaging
38 torch
39 scikit-learn
40 tqdm
41 ];
42
43 # runs successfully in 3.9, however, async isn't correctly closed so it will fail after test suite.
44 doCheck = pythonOlder "3.9";
45
46 # Some packages are not in NixPkgs; other tests try to build distributed
47 # models, which doesn't work in the sandbox.
48 # avoid tests which need special packages
49 pytestFlagsArray = [
50 "--ignore=tests/ignite/contrib/handlers/test_clearml_logger.py"
51 "--ignore=tests/ignite/contrib/handlers/test_lr_finder.py"
52 "--ignore=tests/ignite/contrib/handlers/test_trains_logger.py"
53 "--ignore=tests/ignite/metrics/nlp/test_bleu.py"
54 "--ignore=tests/ignite/metrics/nlp/test_rouge.py"
55 "--ignore=tests/ignite/metrics/gan" # requires pytorch_fid; tries to download model to $HOME
56 "--ignore=tests/ignite/metrics/test_dill.py"
57 "--ignore=tests/ignite/metrics/test_psnr.py"
58 "--ignore=tests/ignite/metrics/test_ssim.py"
59 "tests/"
60 ];
61
62 # disable tests which need specific packages
63 disabledTests = [
64 "idist"
65 "mlflow"
66 "tensorboard"
67 "test_gpu_info" # needs pynvml
68 "test_integration"
69 "test_output_handler" # needs mlflow
70 "test_pbar" # slight output differences
71 "test_setup_clearml_logging"
72 "test_setup_neptune"
73 "test_setup_plx"
74 "test_write_results"
75 "trains"
76 "visdom"
77 ];
78
79 meta = with lib; {
80 description = "High-level training library for PyTorch";
81 homepage = "https://pytorch.org/ignite";
82 license = licenses.bsd3;
83 maintainers = [ maintainers.bcdarwin ];
84 };
85}