2022-05-18 14:49:53 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2023-11-16 04:20:00 +00:00
|
|
|
, pythonOlder
|
|
|
|
, numpy
|
|
|
|
, lightning-utilities
|
2022-05-18 14:49:53 +00:00
|
|
|
, cloudpickle
|
|
|
|
, scikit-learn
|
2023-05-24 13:37:59 +00:00
|
|
|
, scikit-image
|
2022-05-18 14:49:53 +00:00
|
|
|
, packaging
|
|
|
|
, psutil
|
|
|
|
, py-deprecate
|
2022-09-09 14:08:57 +00:00
|
|
|
, torch
|
2022-05-18 14:49:53 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, torchmetrics
|
|
|
|
, pytorch-lightning
|
2023-11-16 04:20:00 +00:00
|
|
|
, pytest-doctestplus
|
|
|
|
, pytest-xdist
|
2022-05-18 14:49:53 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "torchmetrics";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "1.3.0";
|
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
|
|
|
|
|
|
|
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-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-xDUT9GSOn6ZNDFRsFws3NLxBsILKDHPKeEANwM8NXj8=";
|
2022-05-18 14:49:53 +00:00
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
propagatedBuildInputs = [
|
2023-11-16 04:20:00 +00:00
|
|
|
numpy
|
|
|
|
lightning-utilities
|
2022-05-18 14:49:53 +00:00
|
|
|
packaging
|
|
|
|
py-deprecate
|
|
|
|
];
|
|
|
|
|
|
|
|
# Let the user bring their own instance
|
|
|
|
buildInputs = [
|
2022-09-09 14:08:57 +00:00
|
|
|
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
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"torchmetrics"
|
|
|
|
];
|
|
|
|
|
|
|
|
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;
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
SomeoneSerge
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|