1{
2 lib,
3 addict,
4 buildPythonPackage,
5 coverage,
6 fetchFromGitHub,
7 lmdb,
8 matplotlib,
9 mlflow,
10 numpy,
11 opencv4,
12 parameterized,
13 pytestCheckHook,
14 pythonOlder,
15 pyyaml,
16 rich,
17 setuptools,
18 stdenv,
19 termcolor,
20 torch,
21 yapf,
22}:
23
24buildPythonPackage rec {
25 pname = "mmengine";
26 version = "0.10.4";
27 pyproject = true;
28
29 disabled = pythonOlder "3.7";
30
31 src = fetchFromGitHub {
32 owner = "open-mmlab";
33 repo = "mmengine";
34 rev = "refs/tags/v${version}";
35 hash = "sha256-+YDtYHp3BwKvzhmHC6hAZ3Qtc9uRZMo/TpWqdpm2hn0=";
36 };
37
38 build-system = [ setuptools ];
39
40 dependencies = [
41 addict
42 matplotlib
43 numpy
44 opencv4
45 pyyaml
46 rich
47 termcolor
48 yapf
49 ];
50
51 nativeCheckInputs = [
52 coverage
53 lmdb
54 mlflow
55 parameterized
56 pytestCheckHook
57 torch
58 ];
59
60 preCheck =
61 ''
62 export HOME=$TMPDIR
63 ''
64 # Otherwise, the backprop hangs forever. More precisely, this exact line:
65 # https://github.com/open-mmlab/mmengine/blob/02f80e8bdd38f6713e04a872304861b02157905a/tests/test_runner/test_activation_checkpointing.py#L46
66 # Solution suggested in https://github.com/pytorch/pytorch/issues/91547#issuecomment-1370011188
67 + ''
68 export MKL_NUM_THREADS=1
69 '';
70
71 pythonImportsCheck = [ "mmengine" ];
72
73 disabledTestPaths = [
74 # AttributeError
75 "tests/test_fileio/test_backends/test_petrel_backend.py"
76 # Freezes forever?
77 "tests/test_runner/test_activation_checkpointing.py"
78 # missing dependencies
79 "tests/test_visualizer/test_vis_backend.py"
80 ];
81
82 disabledTests = [
83 # Tests are disabled due to sandbox
84 "test_fileclient"
85 "test_http_backend"
86 "test_misc"
87 # RuntimeError
88 "test_dump"
89 "test_deepcopy"
90 "test_copy"
91 "test_lazy_import"
92 # AssertionError
93 "test_lazy_module"
94 # Require unpackaged aim
95 "test_experiment"
96 "test_add_config"
97 "test_add_image"
98 "test_add_scalar"
99 "test_add_scalars"
100 "test_close"
101 ];
102
103 meta = with lib; {
104 description = "Library for training deep learning models based on PyTorch";
105 homepage = "https://github.com/open-mmlab/mmengine";
106 changelog = "https://github.com/open-mmlab/mmengine/releases/tag/v${version}";
107 license = with licenses; [ asl20 ];
108 maintainers = with maintainers; [ rxiao ];
109 broken = stdenv.isDarwin || (stdenv.isLinux && stdenv.isAarch64);
110 };
111}