depot/third_party/nixpkgs/pkgs/development/python-modules/torchmetrics/default.nix
Default email 2c76a4cb41 Project import generated by Copybara.
GitOrigin-RevId: c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad
2023-11-16 04:20:00 +00:00

98 lines
2 KiB
Nix

{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, numpy
, lightning-utilities
, cloudpickle
, scikit-learn
, scikit-image
, packaging
, psutil
, py-deprecate
, torch
, pytestCheckHook
, torchmetrics
, pytorch-lightning
, pytest-doctestplus
, pytest-xdist
}:
let
pname = "torchmetrics";
version = "1.2.0";
in
buildPythonPackage {
inherit pname version;
pyproject = true;
src = fetchFromGitHub {
owner = "Lightning-AI";
repo = "torchmetrics";
rev = "refs/tags/v${version}";
hash = "sha256-g5JuTbiRd8yWx2nM3UE8ejOhuZ0XpAQdS5AC9AlrSFY=";
};
disabled = pythonOlder "3.8";
propagatedBuildInputs = [
numpy
lightning-utilities
packaging
py-deprecate
];
# Let the user bring their own instance
buildInputs = [
torch
];
nativeCheckInputs = [
pytorch-lightning
scikit-learn
scikit-image
cloudpickle
psutil
pytestCheckHook
pytest-doctestplus
pytest-xdist
];
# A cyclic dependency in: integrations/test_lightning.py
doCheck = false;
passthru.tests.check = torchmetrics.overridePythonAttrs (_: {
pname = "${pname}-check";
doCheck = true;
# 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;
});
disabledTests = [
# `IndexError: list index out of range`
"test_metric_lightning_log"
];
disabledTestPaths = [
# These require too many "leftpad-level" dependencies
# Also too cross-dependent
"tests/unittests"
# A trillion import path mismatch errors
"src/torchmetrics"
];
pythonImportsCheck = [
"torchmetrics"
];
meta = with lib; {
description = "Machine learning metrics for distributed, scalable PyTorch applications (used in pytorch-lightning)";
homepage = "https://lightning.ai/docs/torchmetrics/";
license = licenses.asl20;
maintainers = with maintainers; [
SomeoneSerge
];
};
}