nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ boto3
2, buildPythonPackage
3, crc32c
4, which
5, fetchFromGitHub
6, lib
7, matplotlib
8, moto
9, numpy
10, pillow
11, protobuf3_8
12, pytestCheckHook
13, pytorch
14, six
15, soundfile
16, tensorboard
17, torchvision
18}:
19
20buildPythonPackage rec {
21 pname = "tensorboardx";
22 version = "2.4";
23
24 src = fetchFromGitHub {
25 owner = "lanpa";
26 repo = "tensorboardX";
27 rev = "v${version}";
28 sha256 = "sha256-1jWpC64Ubl07Bday4h5ue0wuDj4yPTWL2nhjtoQBnM0=";
29 };
30
31 # apparently torch API changed a bit at 1.6
32 postPatch = ''
33 substituteInPlace tensorboardX/pytorch_graph.py --replace \
34 "torch.onnx.set_training(model, False)" \
35 "torch.onnx.select_model_mode_for_export(model, torch.onnx.TrainingMode.EVAL)"
36 '';
37
38 # Wanted protobuf version is mentioned here:
39 # https://github.com/lanpa/tensorboardX/blob/0d08112618a2bbda4c028a15a137fed3afe77401/compile.sh#L6
40 nativeBuildInputs = [ which protobuf3_8 ];
41
42 # required to make tests deterministic
43 PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION = "python";
44
45 propagatedBuildInputs = [
46 crc32c
47 numpy
48 six
49 soundfile
50 ];
51
52 checkInputs = [
53 boto3
54 matplotlib
55 moto
56 pillow
57 pytestCheckHook
58 pytorch
59 tensorboard
60 torchvision
61 ];
62
63 disabledTests = [
64 # ImportError: Visdom visualization requires installation of Visdom
65 "test_TorchVis"
66 # Requires network access (FileNotFoundError: [Errno 2] No such file or directory: 'wget')
67 "test_onnx_graph"
68 ];
69
70 disabledTestPaths = [
71 # we are not interested in linting errors
72 "tests/test_lint.py"
73 # missing caffe2 dependency
74 "tests/test_caffe2.py"
75 ];
76
77 meta = with lib; {
78 description = "Library for writing tensorboard-compatible logs";
79 homepage = "https://github.com/lanpa/tensorboardX";
80 license = licenses.mit;
81 maintainers = with maintainers; [ lebastr akamaus ];
82 platforms = platforms.all;
83 };
84}