2020-12-29 23:04:35 +00:00
|
|
|
{ stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, ninja
|
|
|
|
, which
|
|
|
|
, libjpeg_turbo
|
|
|
|
, libpng
|
2017-08-19 08:47:23 +01:00
|
|
|
, numpy
|
2020-12-29 23:04:35 +00:00
|
|
|
, scipy
|
2017-08-19 08:47:23 +01:00
|
|
|
, pillow
|
|
|
|
, pytorch
|
2020-12-30 06:42:16 +00:00
|
|
|
, pytest
|
2018-05-23 10:05:39 +01:00
|
|
|
}:
|
2017-08-19 08:47:23 +01:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2020-12-29 23:04:35 +00:00
|
|
|
pname = "torchvision";
|
|
|
|
version = "0.8.2";
|
2017-08-19 08:47:23 +01:00
|
|
|
|
2020-12-29 23:04:35 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pytorch";
|
|
|
|
repo = "vision";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0yhpbq7linrk2qp5jxsvlgkmwa5bn38s9kcswy4jzvmx1fjbkpq0";
|
2017-08-19 08:47:23 +01:00
|
|
|
};
|
|
|
|
|
2020-12-29 23:04:35 +00:00
|
|
|
nativeBuildInputs = [ libpng ninja which ];
|
|
|
|
|
2020-12-30 06:42:16 +00:00
|
|
|
TORCHVISION_INCLUDE = "${libjpeg_turbo.dev}/include/";
|
|
|
|
TORCHVISION_LIBRARY = "${libjpeg_turbo}/lib/";
|
2020-12-29 23:04:35 +00:00
|
|
|
|
|
|
|
buildInputs = [ libjpeg_turbo libpng ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ numpy pillow pytorch scipy ];
|
|
|
|
|
2020-12-30 06:42:16 +00:00
|
|
|
# tries to download many datasets for tests
|
2020-12-29 23:04:35 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2020-12-30 06:42:16 +00:00
|
|
|
checkPhase = ''
|
|
|
|
HOME=$TMPDIR py.test test --ignore=test/test_datasets_download.py
|
|
|
|
'';
|
2020-12-29 23:04:35 +00:00
|
|
|
|
2020-12-30 06:42:16 +00:00
|
|
|
checkInputs = [ pytest ];
|
2017-08-19 08:47:23 +01:00
|
|
|
|
2020-12-29 23:04:35 +00:00
|
|
|
meta = with stdenv.lib; {
|
2017-08-19 08:47:23 +01:00
|
|
|
description = "PyTorch vision library";
|
2020-12-29 23:04:35 +00:00
|
|
|
homepage = "https://pytorch.org/";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ ericsagnes SuperSandro2000 ];
|
2017-08-19 08:47:23 +01:00
|
|
|
};
|
|
|
|
}
|