Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:birdwatcher:machinelearning
python-torchvision
python-torchvision.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File python-torchvision.spec of Package python-torchvision
# # spec file for package python-torchvision # # Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %global flavor @BUILD_FLAVOR@%{nil} %global upstream_name vision %global pytorch_version 2.5.0 %if 0%{?sle_version} == 150600 %global ffmpeg_version 4 %else %global ffmpeg_version 7 %endif %if "%{flavor}" == "standard" %bcond_with cuda %bcond_with rocm %endif %if "%{flavor}" == "rocm" %bcond_without rocm %global rocm_major 6 %global rocm_minor 2 %global rocm_release %{rocm_major}.%{rocm_minor} %global pkg_suffix -rocm-%{rocm_major}-%{rocm_minor} %endif %if "%{flavor}" == "cuda-10-2" %bcond_without cuda %define cudaver 10-2 %endif # Tests are broken (pytest hangs with high resource usage) %bcond_with test %{?sle15_python_module_pythons} Name: python-torchvision%{?pkg_suffix} Version: 0.20.0 Release: 0 Summary: Datasets, Transforms and Models specific to Computer Vision License: BSD-3-Clause URL: https://github.com/pytorch/%{upstream_name} Source: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{upstream_name}-%{version}.tar.gz Patch0: torchvision-fix-build.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module torch%{?pkg_suffix}-devel = %pytorch_version} BuildRequires: %{python_module torch%{?pkg_suffix} = %pytorch_version} BuildRequires: cmake BuildRequires: ninja BuildRequires: fdupes BuildRequires: ffmpeg-%{ffmpeg_version} BuildRequires: ffmpeg-%{ffmpeg_version}-libavcodec-devel BuildRequires: ffmpeg-%{ffmpeg_version}-libavfilter-devel BuildRequires: ffmpeg-%{ffmpeg_version}-libavformat-devel BuildRequires: ffmpeg-%{ffmpeg_version}-libavutil-devel BuildRequires: ffmpeg-%{ffmpeg_version}-libpostproc-devel BuildRequires: ffmpeg-%{ffmpeg_version}-libswresample-devel BuildRequires: ffmpeg-%{ffmpeg_version}-libswscale-devel BuildRequires: libjpeg-devel BuildRequires: libpng-devel BuildRequires: libheif-devel BuildRequires: libavif-devel BuildRequires: python-rpm-macros %if %{with test} BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytest-mock} %if 0%{?sle_version} == 150600 BuildRequires: %{python_module numpy >= 1.0.0} %else BuildRequires: %{python_module numpy >= 2.0.0} %endif BuildRequires: %{python_module Pillow >= 5.3.0} %endif %if 0%{?sle_version} == 150600 BuildRequires: gcc12-c++ BuildRequires: libstdc++6-devel-gcc12 %else BuildRequires: gcc-c++ BuildRequires: libstdc++-devel %endif %if %{with rocm} BuildRequires: rocm-cmake BuildRequires: rocm-rpm-macros # this one pulls in the ROCm Clang package BuildRequires: rocm-release(hip-devel) = %{rocm_release} BuildRequires: cmake(COMgr-ROCm) = %{rocm_release} BuildRequires: cmake(LLVM-ROCm) = %{rocm_release} BuildRequires: cmake(rocm-runtime) = %{rocm_release} BuildRequires: rocm-release(rocm-core-devel) = %{rocm_release} Provides: python-torchvision = %version Provides: rocm-release(python-torchvision) = %{rocm_release} %endif %if 0%{?python_version_nodots} <= 312 Requires: python-numpy >= 1.0.0 %else Requires: python-numpy >= 2.0.0 %endif Requires: python-Pillow >= 5.3.0 Requires: python-pytorch%{?pkg_suffix} = %pytorch_version ExcludeArch: %ix86 %if "%flavor" == "" ExclusiveArch: do_not_build %endif %python_subpackages %description The torchvision package consists of popular datasets, model architectures, and common image transformations for computer vision. %prep %autosetup -p1 -n %{upstream_name}-%{version} sed -i -e '/import requests/d' test/test_image.py sed -i -e '1{/#!.*env python/d;}' \ torchvision/transforms/_transforms_video.py %build # enable sccache during build if available if command -v ccache > /dev/null; then export CCACHE=ccache fi %define buildvars \ export LC_ALL="C.UTF-8" \ export DEBUG=0 \ export TORCHVISION_INCLUDE=/usr/include/ffmpeg \ export TORCHVISION_USE_NVJPEG=0 \ export TORCHVISION_USE_VIDEO_CODEC=0 \ export TORCHVISION_USE_FFMPEG=1 \ export TORCHVISION_USE_PNG=1 \ export TORCHVISION_USE_JPEG=1 \ export TORCHVISION_USE_WEBP=1 \ export TORCHVISION_USE_HEIC=1 \ export TORCHVISION_USE_AVIF=1 \ export BUILD_VERSION=%{version} \ export MAX_JOBS=%{?jobs} \ %if %{with rocm} \ export PYTORCH_ROCM_ARCH="%{list_sep rocm_gpu_list ;}" \ export CC="$CCACHE $(which clang-rocm)" \ export CXX="$CCACHE $(which clang++-rocm)" \ export TORCH_DONT_CHECK_COMPILER_ABI=1 \ %else \ %if 0%{?sle_version} == 150600 \ export CXX="$CCACHE $(which g++-12)" \ export CC="$CCACHE $(which gcc-12)" \ %endif \ %endif \ %{nil} %buildvars %python_build %check %if %{with test} %pytest_arch "--ignore=tests/test_internet.py" -k 'not (test_decode_gif or test_decode_avif_heic_against_pil)' %endif exit 0 %install %buildvars %python_install %python_expand %fdupes %{buildroot}/%{$python_sitearch}/* %files %{python_files} %license LICENSE %doc README.md %{python_sitearch}/torchvision %{python_sitearch}/torchvision-%{version}* %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor