diff --git a/sci-ml/torchvision/Manifest b/sci-ml/torchvision/Manifest index acbb36f56d7ed..aa765ef093cfb 100644 --- a/sci-ml/torchvision/Manifest +++ b/sci-ml/torchvision/Manifest @@ -1 +1,2 @@ DIST torchvision-0.20.0.tar.gz 13149734 BLAKE2B 49493f2b088305f2d4a7502201c233304dc149dc96f4da2a3e93341e2d4e094fc6cdbc7c0d60cf25b97e698120065378408b557b2b0237d6afda7d1ed534487d SHA512 1db98fcc0ef4c018cd00a2c540bc60a47dd3b161f5128337e4a2f0bcce792273b9902108dc01e7d091a3331d9e35f8ab53503cbdba3f2a3cb3865471e7f63baf +DIST torchvision-0.21.0.tar.gz 13149842 BLAKE2B 0651356e97ea591ddeaa18edcfb88b566c1e8e6cc19ab68197772ccea4f10b97ed02f84341ca06d152a65018a43ed7993eddcb8a7ca64b168eb91e9ad2711687 SHA512 38f455b05cd0374d7b5cddbc78b5653edca93909943fa3f3d9875be4009cab8f207662c11b46d7a2f27abefd629adc5f4b877ffd87479c4f9f5de93bddd2661f diff --git a/sci-ml/torchvision/files/torchvision-0.21.0-gentoo.patch b/sci-ml/torchvision/files/torchvision-0.21.0-gentoo.patch new file mode 100644 index 0000000000000..287eaf3e61771 --- /dev/null +++ b/sci-ml/torchvision/files/torchvision-0.21.0-gentoo.patch @@ -0,0 +1,19 @@ +--- a/setup.py 2025-02-22 16:44:42.102439182 +0100 ++++ b/setup.py 2025-02-22 16:46:52.393841294 +0100 +@@ -6,6 +6,7 @@ + import subprocess + import sys + import warnings ++import shlex + from pathlib import Path + + import torch +@@ -127,7 +128,7 @@ + if NVCC_FLAGS is None: + nvcc_flags = [] + else: +- nvcc_flags = NVCC_FLAGS.split(" ") ++ nvcc_flags = shlex.split(NVCC_FLAGS) + extra_compile_args["nvcc"] = nvcc_flags + + if sys.platform == "win32": diff --git a/sci-ml/torchvision/torchvision-0.21.0.ebuild b/sci-ml/torchvision/torchvision-0.21.0.ebuild new file mode 100644 index 0000000000000..b2c5e6151d4c7 --- /dev/null +++ b/sci-ml/torchvision/torchvision-0.21.0.ebuild @@ -0,0 +1,82 @@ +# Copyright 2024-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..13} ) +DISTUTILS_SINGLE_IMPL=1 +DISTUTILS_USE_PEP517=setuptools +DISTUTILS_EXT=1 +inherit cuda distutils-r1 multiprocessing + +DESCRIPTION="Datasets, transforms and models to specific to computer vision" +HOMEPAGE="https://github.com/pytorch/vision" +SRC_URI="https://github.com/pytorch/vision/archive/refs/tags/v${PV}.tar.gz + -> ${P}.tar.gz" + +S="${WORKDIR}"/vision-${PV} + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64" +IUSE="cuda" + +RDEPEND=" + sci-ml/caffe2[cuda?] + sci-ml/pytorch[${PYTHON_SINGLE_USEDEP}] + dev-python/numpy + dev-python/pillow + media-libs/libjpeg-turbo:= + media-libs/libpng:= +" +BDEPEND=" + test? ( + $(python_gen_cond_dep ' + dev-python/pytest-mock[${PYTHON_USEDEP}] + dev-python/lmdb[${PYTHON_USEDEP}] + ') + ) +" + +PATCHES=( "${FILESDIR}"/${P}-gentoo.patch ) + +src_prepare() { + use cuda && cuda_src_prepare + distutils-r1_src_prepare +} + +distutils_enable_tests pytest + +python_compile() { + addpredict /dev/kfd + + FORCE_CUDA=$(usex cuda 1 0) \ + NVCC_FLAGS="${NVCCFLAGS}" \ + MAX_JOBS="$(makeopts_jobs)" \ + distutils-r1_python_compile -j1 +} + +python_test() { + rm -rf torchvision || die + + local EPYTEST_IGNORE=( + test/test_videoapi.py + ) + local EPYTEST_DESELECT=( + test/test_backbone_utils.py::TestFxFeatureExtraction::test_forward_backward + test/test_backbone_utils.py::TestFxFeatureExtraction::test_jit_forward_backward + test/test_models.py::test_classification_model + test/test_extended_models.py::TestHandleLegacyInterface::test_pretrained_pos + test/test_extended_models.py::TestHandleLegacyInterface::test_equivalent_behavior_weights + test/test_image.py::test_decode_avif[decode_avif] + test/test_image.py::test_decode_bad_encoded_data + test/test_image.py::test_decode_gif[True-earth] + test/test_image.py::test_decode_heic[decode_heic] + test/test_image.py::test_decode_webp + test/test_models.py::test_quantized_classification_model + test/test_ops.py::test_roi_opcheck + test/test_ops.py::TestDeformConv::test_aot_dispatch_dynamic__test_backward + test/test_ops.py::TestDeformConv::test_aot_dispatch_dynamic__test_forward + ) + epytest +}