2024-06-05 15:53:02 +00:00
|
|
|
{
|
2024-09-19 14:19:46 +00:00
|
|
|
lib,
|
2024-06-05 15:53:02 +00:00
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
2024-09-19 14:19:46 +00:00
|
|
|
|
|
|
|
# build-system
|
|
|
|
setuptools,
|
|
|
|
|
|
|
|
# dependencies
|
2024-06-05 15:53:02 +00:00
|
|
|
numpy,
|
|
|
|
packaging,
|
2024-09-19 14:19:46 +00:00
|
|
|
torch,
|
|
|
|
typing-extensions,
|
|
|
|
|
|
|
|
# tests
|
|
|
|
onnx,
|
2024-06-05 15:53:02 +00:00
|
|
|
pytestCheckHook,
|
2024-09-19 14:19:46 +00:00
|
|
|
torchvision,
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonAtLeast,
|
|
|
|
stdenv,
|
2022-02-20 05:27:41 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pytorch-pfn-extras";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "0.7.7";
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
2022-02-20 05:27:41 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pfnet";
|
2024-01-13 08:15:51 +00:00
|
|
|
repo = "pytorch-pfn-extras";
|
2022-04-27 09:35:20 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-0+ltkm7OH18hlpHYyZCmy1rRleF52IM2BjLoW44tJUY=";
|
2022-02-20 05:27:41 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
build-system = [ setuptools ];
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
dependencies = [
|
|
|
|
numpy
|
|
|
|
packaging
|
|
|
|
torch
|
|
|
|
typing-extensions
|
|
|
|
];
|
2022-02-20 05:27:41 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
onnx
|
|
|
|
pytestCheckHook
|
|
|
|
torchvision
|
|
|
|
];
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
# Requires CUDA access which is not possible in the nix environment.
|
|
|
|
"-m 'not gpu and not mpi'"
|
|
|
|
"-Wignore::DeprecationWarning"
|
2024-09-19 14:19:46 +00:00
|
|
|
|
|
|
|
# FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly...
|
|
|
|
"-Wignore::FutureWarning"
|
2024-04-21 15:54:59 +00:00
|
|
|
];
|
2022-02-20 05:27:41 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "pytorch_pfn_extras" ];
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
disabledTests =
|
|
|
|
[
|
|
|
|
# AssertionError: assert 4 == 0
|
|
|
|
# where 4 = <MagicMock id='140733587469184'>.call_count
|
|
|
|
"test_lr_scheduler_wait_for_first_optimizer_step"
|
|
|
|
]
|
|
|
|
++ lib.optionals (stdenv.hostPlatform.isDarwin) [
|
|
|
|
# torch.distributed is not available on darwin
|
|
|
|
"test_create_distributed_evaluator"
|
|
|
|
"test_distributed_evaluation"
|
|
|
|
"test_distributed_evaluator_progress_bar"
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
disabledTestPaths =
|
|
|
|
[
|
|
|
|
# Requires optuna which is currently (2022-02-16) marked as broken.
|
|
|
|
"tests/pytorch_pfn_extras_tests/test_config_types.py"
|
2022-02-20 05:27:41 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# requires onnxruntime which was removed because of poor maintainability
|
|
|
|
# See https://github.com/NixOS/nixpkgs/pull/105951 https://github.com/NixOS/nixpkgs/pull/155058
|
|
|
|
"tests/pytorch_pfn_extras_tests/onnx_tests/test_annotate.py"
|
|
|
|
"tests/pytorch_pfn_extras_tests/onnx_tests/test_as_output.py"
|
|
|
|
"tests/pytorch_pfn_extras_tests/onnx_tests/test_export.py"
|
|
|
|
"tests/pytorch_pfn_extras_tests/onnx_tests/test_export_testcase.py"
|
|
|
|
"tests/pytorch_pfn_extras_tests/onnx_tests/test_lax.py"
|
|
|
|
"tests/pytorch_pfn_extras_tests/onnx_tests/test_load_model.py"
|
|
|
|
"tests/pytorch_pfn_extras_tests/onnx_tests/test_torchvision.py"
|
|
|
|
"tests/pytorch_pfn_extras_tests/onnx_tests/utils.py"
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# RuntimeError: No Op registered for Gradient with domain_version of 9
|
|
|
|
"tests/pytorch_pfn_extras_tests/onnx_tests/test_grad.py"
|
|
|
|
]
|
|
|
|
++ lib.optionals (pythonAtLeast "3.12") [
|
|
|
|
# RuntimeError: Dynamo is not supported on Python 3.12+
|
|
|
|
"tests/pytorch_pfn_extras_tests/dynamo_tests/test_compile.py"
|
|
|
|
"tests/pytorch_pfn_extras_tests/test_ops/test_register.py"
|
|
|
|
]
|
|
|
|
++ lib.optionals (stdenv.hostPlatform.isDarwin) [
|
|
|
|
# torch.distributed is not available on darwin
|
2024-09-19 14:19:46 +00:00
|
|
|
"tests/pytorch_pfn_extras_tests/distributed_tests/test_distributed_validation_sampler.py"
|
|
|
|
"tests/pytorch_pfn_extras_tests/nn_tests/parallel_tests/test_distributed.py"
|
|
|
|
"tests/pytorch_pfn_extras_tests/profiler_tests/test_record.py"
|
|
|
|
"tests/pytorch_pfn_extras_tests/profiler_tests/test_time_summary.py"
|
|
|
|
"tests/pytorch_pfn_extras_tests/training_tests/extensions_tests/test_accumulate.py"
|
2024-06-05 15:53:02 +00:00
|
|
|
"tests/pytorch_pfn_extras_tests/training_tests/extensions_tests/test_sharded_snapshot.py"
|
|
|
|
]
|
|
|
|
++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
|
|
|
|
# RuntimeError: internal error
|
|
|
|
# convolution (e.g. F.conv3d) causes runtime error
|
|
|
|
"tests/pytorch_pfn_extras_tests/nn_tests/modules_tests/test_lazy_conv.py"
|
|
|
|
];
|
2022-02-20 05:27:41 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
meta = {
|
2022-02-20 05:27:41 +00:00
|
|
|
description = "Supplementary components to accelerate research and development in PyTorch";
|
|
|
|
homepage = "https://github.com/pfnet/pytorch-pfn-extras";
|
2024-09-19 14:19:46 +00:00
|
|
|
changelog = "https://github.com/pfnet/pytorch-pfn-extras/releases/tag/v${version}";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ samuela ];
|
2022-02-20 05:27:41 +00:00
|
|
|
};
|
|
|
|
}
|