0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

python312Packages.pytorch-metric-learning: cleanup, fix on darwin (#410143)

This commit is contained in:
Gaétan Lepage 2025-05-23 19:58:53 +02:00 committed by GitHub
commit 3765ba2acf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,10 +1,9 @@
{ {
stdenv,
lib, lib,
stdenv,
config,
buildPythonPackage, buildPythonPackage,
fetchFromGitHub, fetchFromGitHub,
isPy27,
config,
# build-system # build-system
setuptools, setuptools,
@ -20,9 +19,11 @@
tensorboard, tensorboard,
# tests # tests
cudaSupport ? config.cudaSupport,
pytestCheckHook, pytestCheckHook,
torchvision, torchvision,
writableTmpDirAsHomeHook,
cudaSupport ? config.cudaSupport,
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -30,11 +31,9 @@ buildPythonPackage rec {
version = "2.8.1"; version = "2.8.1";
pyproject = true; pyproject = true;
disabled = isPy27;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "KevinMusgrave"; owner = "KevinMusgrave";
repo = pname; repo = "pytorch-metric-learning";
tag = "v${version}"; tag = "v${version}";
hash = "sha256-WO/gv8rKkxY3pR627WrEPVyvZnvUZIKMzOierIW8bJA="; hash = "sha256-WO/gv8rKkxY3pR627WrEPVyvZnvUZIKMzOierIW8bJA=";
}; };
@ -64,7 +63,6 @@ buildPythonPackage rec {
}; };
preCheck = '' preCheck = ''
export HOME=$TMP
export TEST_DEVICE=cpu export TEST_DEVICE=cpu
export TEST_DTYPES=float32,float64 # half-precision tests fail on CPU export TEST_DTYPES=float32,float64 # half-precision tests fail on CPU
''; '';
@ -73,6 +71,7 @@ buildPythonPackage rec {
nativeCheckInputs = [ nativeCheckInputs = [
pytestCheckHook pytestCheckHook
torchvision torchvision
writableTmpDirAsHomeHook
] ++ lib.flatten (lib.attrValues optional-dependencies); ] ++ lib.flatten (lib.attrValues optional-dependencies);
disabledTests = disabledTests =
@ -100,6 +99,12 @@ buildPythonPackage rec {
"test_with_same_parent_label_tester" "test_with_same_parent_label_tester"
]; ];
disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
# Fatal Python error: Segmentation fault
"tests/testers/"
"tests/utils/"
];
meta = { meta = {
description = "Metric learning library for PyTorch"; description = "Metric learning library for PyTorch";
homepage = "https://github.com/KevinMusgrave/pytorch-metric-learning"; homepage = "https://github.com/KevinMusgrave/pytorch-metric-learning";