about summary refs log tree commit diff
path: root/pkgs/development/python-modules/ignite/default.nix
blob: 8d6145d9ad8471d732673e364987b58123788529 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,
  setuptools,
  pytestCheckHook,
  pytest-xdist,
  torchvision,
  matplotlib,
  mock,
  packaging,
  torch,
}:

buildPythonPackage rec {
  pname = "ignite";
  version = "0.5.1";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "pytorch";
    repo = pname;
    rev = "refs/tags/v${version}";
    hash = "sha256-J0xrqAGwH0bAs59T7zA8irMWOGbE2+Zd9kwqxYUYYMA=";
  };

  build-system = [ setuptools ];

  dependencies = [
    packaging
    torch
  ];

  nativeCheckInputs = [
    pytestCheckHook
    matplotlib
    mock
    pytest-xdist
    torchvision
  ];

  # runs successfully in 3.9, however, async isn't correctly closed so it will fail after test suite.
  doCheck = pythonOlder "3.9";

  # Some packages are not in NixPkgs; other tests try to build distributed
  # models, which doesn't work in the sandbox.
  # avoid tests which need special packages
  pytestFlagsArray = [
    "--ignore=tests/ignite/contrib/handlers/test_clearml_logger.py"
    "--ignore=tests/ignite/contrib/handlers/test_lr_finder.py"
    "--ignore=tests/ignite/contrib/handlers/test_trains_logger.py"
    "--ignore=tests/ignite/metrics/nlp/test_bleu.py"
    "--ignore=tests/ignite/metrics/nlp/test_rouge.py"
    "--ignore=tests/ignite/metrics/gan" # requires pytorch_fid; tries to download model to $HOME
    "--ignore=tests/ignite/metrics/test_dill.py"
    "--ignore=tests/ignite/metrics/test_psnr.py"
    "--ignore=tests/ignite/metrics/test_ssim.py"
    "tests/"
  ];

  # disable tests which need specific packages
  disabledTests = [
    "idist"
    "mlflow"
    "tensorboard"
    "test_gpu_info" # needs pynvml
    "test_integration"
    "test_output_handler" # needs mlflow
    "test_pbar" # slight output differences
    "test_setup_clearml_logging"
    "test_setup_neptune"
    "test_setup_plx"
    "test_write_results"
    "trains"
    "visdom"
  ];

  pythonImportsCheck = [
    "ignite"
    "ignite.engine"
    "ignite.handlers"
    "ignite.metrics"
    "ignite.distributed"
    "ignite.exceptions"
    "ignite.utils"
    "ignite.contrib"
  ];

  meta = {
    description = "High-level training library for PyTorch";
    homepage = "https://pytorch-ignite.ai";
    changelog = "https://github.com/pytorch/ignite/releases/tag/v${version}";
    license = lib.licenses.bsd3;
    maintainers = [ lib.maintainers.bcdarwin ];
    # ModuleNotFoundError: No module named 'torch._C._distributed_c10d'; 'torch._C' is not a package
    broken = stdenv.isDarwin;
  };
}