diff --git a/python-xformers.spec b/python-xformers.spec new file mode 100644 index 0000000000000000000000000000000000000000..41594dd07b960b07fb2487b638895338bdf6bd31 --- /dev/null +++ b/python-xformers.spec @@ -0,0 +1,100 @@ +%define anolis_release 1 +%global pypi_name xformers +%global pypi_version 0.0.24 + +Name: python-%{pypi_name} +Version: %{pypi_version} +Release: %{anolis_release}%{?dist} +Summary: XFormers: A collection of composable Transformer building blocks + +License: BSD 3-Clause License +URL: https://facebookresearch.github.io/xformers/ +Source0: %{pypi_source} + +%define have_cuda 1 +%define gpu_target_ptx "50" +%define gpu_target_bin 5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;9.0 +%global vcu_maj 12 +%global vcu_min 1 + +BuildRequires: python3-devel +BuildRequires: python3dist(numpy) +BuildRequires: python3dist(setuptools) +BuildRequires: python3dist(torch) >= 1.12 +BuildRequires: pytorch-devel git ninja-build + +%if %{have_cuda} +BuildRequires: cuda-nvcc-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-nvtx-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-cupti-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-nvprune-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-cudart-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-nvml-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-nvrtc-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-driver-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-profiler-api-%{vcu_maj}-%{vcu_min} +BuildRequires: nvidia-driver-cuda-libs +BuildRequires: libnpp-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libcurand-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libcusparse-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libcublas-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libcusolver-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libcufft-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libcurand-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libnvjpeg-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libnccl-devel +Requires: cuda-cudart-%{vcu_maj}-%{vcu_min} +Requires: cuda-nvrtc-%{vcu_maj}-%{vcu_min} +Requires: cuda-nvtx-%{vcu_maj}-%{vcu_min} +Requires: python3dist(numpy) +Requires: python3dist(torch) >= 1.12 +%endif + +%description +XFormers: A collection of composable Transformer building blocks.XFormers aims +at being able to reproduce most architectures in the Transformer-family +SOTA,defined as compatible and combined building blocks as opposed to +monolithic models + +%package -n python3-%{pypi_name} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{pypi_name}} + +%description -n python3-%{pypi_name} +XFormers: A collection of composable Transformer building blocks.XFormers aims +at being able to reproduce most architectures in the Transformer-family +SOTA,defined as compatible and combined building blocks as opposed to +monolithic models + + +%prep +%autosetup -n %{pypi_name}-%{pypi_version} +# Remove bundled egg-info +rm -rf %{pypi_name}.egg-info +sed -i '/torch/d' requirements.txt + +%build +export NVCC_FLAGS=" --compiler-options -fPIC -Wno-deprecated-gpu-targets -allow-unsupported-compiler --fatbin-options -compress-all" + +export FORCE_CUDA=1 +# thread number is set intentionally since this procedure is extremely memory consuming +# any larger number will cause out of memory error +export MAX_JOBS=4 +export CUDA_HOME=/usr/local/cuda-%{vcu_maj}.%{vcu_min} +export LD_LIBRARY_PATH=/usr/local/cuda-%{vcu_maj}.%{vcu_min}/lib64/ +export TORCH_CUDA_ARCH_LIST="%{gpu_target_bin}" +%py3_build + +%install +%py3_install + +%files -n python3-%{pypi_name} +%license LICENSE +%doc README.md +%{python3_sitearch}/%{pypi_name} +%{python3_sitearch}/%{pypi_name}-%{pypi_version}-py%{python3_version}.egg-info + + +%changelog +* Sun Feb 18 2024 zhongling.h - 0.0.24-1 +- Initial package. diff --git a/xformers-0.0.24.tar.gz b/xformers-0.0.24.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..f3ef616afb6f60c443fde989327d0abf1f3ddbd6 Binary files /dev/null and b/xformers-0.0.24.tar.gz differ