mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-21 04:13:12 +00:00
Merge pull request #242997 from tjni/tensorboardx
python310Packages.tensorboardx: fix darwin builds
This commit is contained in:
commit
03dcbf5a0b
@ -1,8 +1,8 @@
|
||||
{ boto3
|
||||
, buildPythonPackage
|
||||
, crc32c
|
||||
, which
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, lib
|
||||
, matplotlib
|
||||
, moto
|
||||
@ -13,8 +13,10 @@
|
||||
, torch
|
||||
, six
|
||||
, soundfile
|
||||
, stdenv
|
||||
, tensorboard
|
||||
, torchvision
|
||||
, which
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
@ -29,12 +31,33 @@ buildPythonPackage rec {
|
||||
hash = "sha256-Np0Ibn51qL0ORwq1IY8lUle05MQDdb5XkI1uzGOKJno=";
|
||||
};
|
||||
|
||||
# apparently torch API changed a bit at 1.6
|
||||
postPatch = ''
|
||||
substituteInPlace tensorboardX/pytorch_graph.py --replace \
|
||||
"torch.onnx.set_training(model, False)" \
|
||||
"torch.onnx.select_model_mode_for_export(model, torch.onnx.TrainingMode.EVAL)"
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
name = "fix-test-multiprocess-fork-on-darwin.patch";
|
||||
url = "https://github.com/lanpa/tensorboardX/commit/246a867237ff12893351b9275a1e297ee2861319.patch";
|
||||
hash = "sha256-ObUaIi1gFcGZAvDOEtZFd9TjZZUp3k89tYwmDQ5yOWg=";
|
||||
})
|
||||
# https://github.com/lanpa/tensorboardX/pull/706
|
||||
(fetchpatch {
|
||||
name = "fix-test-use-matplotlib-agg-backend.patch";
|
||||
url = "https://github.com/lanpa/tensorboardX/commit/751821c7af7f7f2cb724938e36fa04e814c0e4de.patch";
|
||||
hash = "sha256-Tu76ZRTh8fGj+/CzpqJO65hKrDFASbmzoLVIZ0kyLQA=";
|
||||
})
|
||||
# https://github.com/lanpa/tensorboardX/pull/707
|
||||
(fetchpatch {
|
||||
name = "fix-test-handle-numpy-float128-missing.patch";
|
||||
url = "https://github.com/lanpa/tensorboardX/commit/38f57ffc3b3dd91e76b13ec97404278065fbc782.patch";
|
||||
hash = "sha256-5Po41lHiO5hKi4ZtWR98/wwDe9HKZdADNTv40mgIEvk=";
|
||||
})
|
||||
# https://github.com/lanpa/tensorboardX/pull/708
|
||||
(fetchpatch {
|
||||
name = "fix-test-respect-tmpdir.patch";
|
||||
url = "https://github.com/lanpa/tensorboardX/commit/b0191d1cfb8a23def76e465d20fd59302c894f32.patch";
|
||||
hash = "sha256-6rSncJ16P1u70Cz9nObo8lMD7Go50BR3DZLgP4bODk4=";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# Version detection seems broken here, the version reported by python is
|
||||
# newer than the protobuf package itself.
|
||||
sed -i -e "s/'protobuf[^']*'/'protobuf'/" setup.py
|
||||
@ -71,6 +94,10 @@ buildPythonPackage rec {
|
||||
"test_TorchVis"
|
||||
# Requires network access (FileNotFoundError: [Errno 2] No such file or directory: 'wget')
|
||||
"test_onnx_graph"
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
# Fails with a mysterious error in pytorch:
|
||||
# RuntimeError: required keyword attribute 'name' has the wrong type
|
||||
"test_pytorch_graph"
|
||||
];
|
||||
|
||||
disabledTestPaths = [
|
||||
|
Loading…
Reference in New Issue
Block a user