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