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";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "1.2.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}";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-g5JuTbiRd8yWx2nM3UE8ejOhuZ0XpAQdS5AC9AlrSFY=";
|
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/";
|
2022-05-18 14:49:53 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
SomeoneSerge
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|