2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fetchpatch,
|
|
|
|
pythonOlder,
|
|
|
|
torch,
|
|
|
|
torchvision,
|
|
|
|
pytestCheckHook,
|
|
|
|
transformers,
|
2022-01-19 23:45:15 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "torchinfo";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "1.8.0";
|
2022-06-16 17:23:12 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "TylerYep";
|
2023-11-16 04:20:00 +00:00
|
|
|
repo = "torchinfo";
|
2022-06-16 17:23:12 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-pPjg498aT8y4b4tqIzNxxKyobZX01u+66ScS/mee51Q=";
|
2022-01-19 23:45:15 +00:00
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
patches = [
|
2024-06-05 15:53:02 +00:00
|
|
|
(fetchpatch {
|
|
|
|
# Add support for Python 3.11 and pytorch 2.1
|
2023-11-16 04:20:00 +00:00
|
|
|
url = "https://github.com/TylerYep/torchinfo/commit/c74784c71c84e62bcf56664653b7f28d72a2ee0d.patch";
|
|
|
|
hash = "sha256-xSSqs0tuFpdMXUsoVv4sZLCeVnkK6pDDhX/Eobvn5mw=";
|
2024-06-05 15:53:02 +00:00
|
|
|
includes = [ "torchinfo/model_statistics.py" ];
|
2023-11-16 04:20:00 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
propagatedBuildInputs = [
|
2022-09-09 14:08:57 +00:00
|
|
|
torch
|
2022-01-19 23:45:15 +00:00
|
|
|
torchvision
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-01-19 23:45:15 +00:00
|
|
|
pytestCheckHook
|
2023-11-16 04:20:00 +00:00
|
|
|
transformers
|
2022-01-19 23:45:15 +00:00
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
'';
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
disabledTests = [
|
|
|
|
# Skip as it downloads pretrained weights (require network access)
|
|
|
|
"test_eval_order_doesnt_matter"
|
2023-11-16 04:20:00 +00:00
|
|
|
"test_flan_t5_small"
|
2022-06-16 17:23:12 +00:00
|
|
|
# AssertionError in output
|
|
|
|
"test_google"
|
2023-11-16 04:20:00 +00:00
|
|
|
# "addmm_impl_cpu_" not implemented for 'Half'
|
|
|
|
"test_input_size_half_precision"
|
2022-01-19 23:45:15 +00:00
|
|
|
];
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
disabledTestPaths = [
|
2023-11-16 04:20:00 +00:00
|
|
|
# Test requires network access
|
2023-04-12 12:48:02 +00:00
|
|
|
"tests/torchinfo_xl_test.py"
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "torchinfo" ];
|
2022-01-19 23:45:15 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
meta = with lib; {
|
2022-01-19 23:45:15 +00:00
|
|
|
description = "API to visualize pytorch models";
|
|
|
|
homepage = "https://github.com/TylerYep/torchinfo";
|
2022-06-16 17:23:12 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ petterstorvik ];
|
2022-01-19 23:45:15 +00:00
|
|
|
};
|
|
|
|
}
|