2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pythonOlder,
|
|
|
|
numpy,
|
|
|
|
lightning-utilities,
|
|
|
|
cloudpickle,
|
|
|
|
scikit-learn,
|
|
|
|
scikit-image,
|
|
|
|
packaging,
|
|
|
|
pretty-errors,
|
|
|
|
psutil,
|
|
|
|
py-deprecate,
|
|
|
|
torch,
|
|
|
|
pytestCheckHook,
|
|
|
|
torchmetrics,
|
|
|
|
pytorch-lightning,
|
|
|
|
pytest-doctestplus,
|
|
|
|
pytest-xdist,
|
2022-05-18 14:49:53 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "torchmetrics";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "1.4.0.post0";
|
2022-05-18 14:49:53 +00:00
|
|
|
in
|
|
|
|
buildPythonPackage {
|
|
|
|
inherit pname version;
|
2023-11-16 04:20:00 +00:00
|
|
|
pyproject = true;
|
2022-05-18 14:49:53 +00:00
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
src = fetchFromGitHub {
|
2023-11-16 04:20:00 +00:00
|
|
|
owner = "Lightning-AI";
|
|
|
|
repo = "torchmetrics";
|
2022-05-18 14:49:53 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-tQqlLfdk8rSJqwR3rC7kqnM+pLFYZSPHfI7RmIi2Iq4=";
|
2022-05-18 14:49:53 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
dependencies = [
|
2023-11-16 04:20:00 +00:00
|
|
|
numpy
|
|
|
|
lightning-utilities
|
2022-05-18 14:49:53 +00:00
|
|
|
packaging
|
2024-05-15 15:35:15 +00:00
|
|
|
pretty-errors
|
2022-05-18 14:49:53 +00:00
|
|
|
py-deprecate
|
|
|
|
];
|
|
|
|
|
|
|
|
# Let the user bring their own instance
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = [ torch ];
|
2022-05-18 14:49:53 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-05-18 14:49:53 +00:00
|
|
|
pytorch-lightning
|
|
|
|
scikit-learn
|
2023-05-24 13:37:59 +00:00
|
|
|
scikit-image
|
2022-05-18 14:49:53 +00:00
|
|
|
cloudpickle
|
|
|
|
psutil
|
|
|
|
pytestCheckHook
|
2023-11-16 04:20:00 +00:00
|
|
|
pytest-doctestplus
|
|
|
|
pytest-xdist
|
2022-05-18 14:49:53 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# A cyclic dependency in: integrations/test_lightning.py
|
|
|
|
doCheck = false;
|
|
|
|
passthru.tests.check = torchmetrics.overridePythonAttrs (_: {
|
2023-11-16 04:20:00 +00:00
|
|
|
pname = "${pname}-check";
|
2022-05-18 14:49:53 +00:00
|
|
|
doCheck = true;
|
2023-11-16 04:20:00 +00:00
|
|
|
# We don't have to install because the only purpose
|
|
|
|
# of this passthru test is to, well, test.
|
|
|
|
# This fixes having to set `catchConflicts` to false.
|
|
|
|
dontInstall = true;
|
2022-05-18 14:49:53 +00:00
|
|
|
});
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
disabledTests = [
|
|
|
|
# `IndexError: list index out of range`
|
|
|
|
"test_metric_lightning_log"
|
|
|
|
];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
# These require too many "leftpad-level" dependencies
|
2023-11-16 04:20:00 +00:00
|
|
|
# Also too cross-dependent
|
|
|
|
"tests/unittests"
|
2022-05-18 14:49:53 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
# A trillion import path mismatch errors
|
|
|
|
"src/torchmetrics"
|
2022-05-18 14:49:53 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "torchmetrics" ];
|
2022-05-18 14:49:53 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Machine learning metrics for distributed, scalable PyTorch applications (used in pytorch-lightning)";
|
2023-11-16 04:20:00 +00:00
|
|
|
homepage = "https://lightning.ai/docs/torchmetrics/";
|
2024-01-02 11:29:13 +00:00
|
|
|
changelog = "https://github.com/Lightning-AI/torchmetrics/releases/tag/v${version}";
|
2022-05-18 14:49:53 +00:00
|
|
|
license = licenses.asl20;
|
2024-06-05 15:53:02 +00:00
|
|
|
maintainers = with maintainers; [ SomeoneSerge ];
|
2022-05-18 14:49:53 +00:00
|
|
|
};
|
|
|
|
}
|