Commit d4628d9d authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files
parent 673c549a
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -12,26 +12,28 @@
  torch,

  # tests
  ipython,
  pytestCheckHook,
  pytest-doctestplus,
  pytest-xdist,
  pytorch-lightning,
  scikit-image,
  transformers,

  # passthru
  torchmetrics,
}:

buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
  pname = "torchmetrics";
  version = "1.8.2";
  version = "1.9.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "Lightning-AI";
    repo = "torchmetrics";
    tag = "v${version}";
    hash = "sha256-OsU2JpKcbe1AuSIAyZLjDpFdsSk2q3kMGBcNXtIJm3Q=";
    tag = "v${finalAttrs.version}";
    hash = "sha256-jlIZQWu0lE37Gv0Rzmgm+kG3dEeT1p3pKdXzkUgq3Rw=";
  };

  dependencies = [
@@ -44,17 +46,19 @@ buildPythonPackage rec {
  buildInputs = [ torch ];

  nativeCheckInputs = [
    ipython
    pytestCheckHook
    pytest-doctestplus
    pytest-xdist
    pytorch-lightning
    scikit-image
    transformers
  ];

  # A cyclic dependency in: integrations/test_lightning.py
  doCheck = false;
  passthru.tests.check = torchmetrics.overridePythonAttrs (_: {
    pname = "${pname}-check";
    pname = "${finalAttrs.pname}-check";
    doCheck = true;
    # We don't have to install because the only purpose
    # of this passthru test is to, well, test.
@@ -62,6 +66,11 @@ buildPythonPackage rec {
    dontInstall = true;
  });

  pytestFlags = [
    # The (path: py.path.local) argument is deprecated, please use (file_path: pathlib.Path)
    "-Wignore::pytest.PytestRemovedIn9Warning"
  ];

  disabledTestPaths = [
    # These require too many "leftpad-level" dependencies
    # Also too cross-dependent
@@ -71,8 +80,9 @@ buildPythonPackage rec {
    "examples/audio/pesq.py"

    # Require internet access
    "examples/text/bertscore.py"
    "examples/audio/text_to_speech.py"
    "examples/image/clip_score.py"
    "examples/text/bertscore.py"
    "examples/text/perplexity.py"
    "examples/text/rouge.py"

@@ -85,8 +95,8 @@ buildPythonPackage rec {
  meta = {
    description = "Machine learning metrics for distributed, scalable PyTorch applications (used in pytorch-lightning)";
    homepage = "https://lightning.ai/docs/torchmetrics/";
    changelog = "https://github.com/Lightning-AI/torchmetrics/releases/tag/v${version}";
    changelog = "https://github.com/Lightning-AI/torchmetrics/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ SomeoneSerge ];
  };
}
})