From 6e10bd21ac6fc878657b24684723ccd05e41d385 Mon Sep 17 00:00:00 2001
From: dan_the_3rd <43445237+danthe3rd@users.noreply.github.com>
Date: Wed, 20 Nov 2024 13:01:55 +0000
Subject: [PATCH] Remove build of conda binaries, as PyTorch no longer
publishes on conda (fairinternal/xformers#1258)
__original_commit__ = fairinternal/xformers@5f58a7979441810cfb493ea2c0d04c3bbf7e79af
---
.../compute_wheel_version.py | 0
.github/workflows/conda.yml | 155 ---------------
.github/workflows/rocm_build.yml | 2 +-
.github/workflows/wheels.yml | 2 +-
.github/workflows/wheels_build.yml | 2 +-
.github/workflows/wheels_upload_pip.yml | 2 +-
CHANGELOG.md | 4 +
README.md | 14 +-
packaging/build_conda.py | 182 ------------------
packaging/xformers/meta.yaml | 44 -----
10 files changed, 9 insertions(+), 398 deletions(-)
rename {packaging => .github}/compute_wheel_version.py (100%)
delete mode 100644 .github/workflows/conda.yml
delete mode 100644 packaging/build_conda.py
delete mode 100644 packaging/xformers/meta.yaml
diff --git a/packaging/compute_wheel_version.py b/.github/compute_wheel_version.py
similarity index 100%
rename from packaging/compute_wheel_version.py
rename to .github/compute_wheel_version.py
diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml
deleted file mode 100644
index 5f4dc77fbc..0000000000
--- a/.github/workflows/conda.yml
+++ /dev/null
@@ -1,155 +0,0 @@
-name: conda
-
-on:
- workflow_dispatch: {}
- pull_request:
- paths:
- - "packaging/**"
- - ".github/workflows/conda.yml"
- - "setup.py"
- - "requirements*.txt"
- push:
- branches:
- - main
- tags:
- - "v[0-9]+*"
-
-# this yaml file can be cleaned up using yaml anchors, but they're not supported in github actions yet
-# https://github.com/actions/runner/issues/1182
-
-env:
- MAX_JOBS: 3 # Avoids OOMs
- XFORMERS_BUILD_TYPE: "Release"
- XFORMERS_PACKAGE_FROM: "conda-${{ github.ref_name }}"
- # https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
- ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: "true"
-
-jobs:
- build:
- strategy:
- fail-fast: false
- matrix:
- python:
- - "3.10"
- - "3.11"
- - "3.12"
- config:
- - torch_version: "2.5.1"
- torch_channel: "pytorch"
- cuda_version: "12.1.0"
- cuda_dep_runtime: ">=12.0,<13.0"
- cuda_short_version: "121"
-
- - torch_version: "2.5.1"
- torch_channel: "pytorch"
- cuda_version: "11.8.0"
- cuda_dep_runtime: ">=11.7,<11.9"
- cuda_short_version: "118"
-
- name: py${{ matrix.python }}-torch${{ matrix.config.torch_version }}-cu${{ matrix.config.cuda_version }}
- runs-on: 8-core-ubuntu # 32GB RAM, 8 vCPUs
-
- container:
- image: quay.io/pypa/manylinux_2_28_x86_64
- env:
- # you need at least cuda 5.0 for some of the stuff compiled here.
- TORCH_CUDA_ARCH_LIST: '6.0+PTX 7.0 7.5 8.0+PTX'
-
- timeout-minutes: 360
- defaults:
- run:
- shell: bash
- steps:
- - if: fromJSON(matrix.config.cuda_short_version) >= 120
- run: |
- echo "TORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST 9.0a" >> ${GITHUB_ENV}
- - name: System info
- run: |
- pwd
- df -h
- ldd --version
- echo "Memory and swap:"
- free -h
- echo
- swapon --show
- - name: Set tag = 'dev'
- run: echo "XFORMERS_CONDA_TAG=dev" >> $GITHUB_ENV
- - name: Set tag = 'main'
- if: startsWith(github.ref, 'refs/tags/v')
- run: echo "XFORMERS_CONDA_TAG=main" >> $GITHUB_ENV
- - run: echo "${XFORMERS_CONDA_TAG}"
- - name: Recursive checkout
- uses: actions/checkout@v3
- with:
- submodules: recursive
- path: "."
- fetch-depth: 0 # for tags
- - name: Install micromamba
- shell: bash -l {0}
- run: |
- set -ex
- curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
- echo "eval \"\$($(pwd)/bin/micromamba shell hook --shell bash)\"" >> ~/.profile
- - run: |
- micromamba config set channel_priority strict
- micromamba create --name env -y anaconda-client conda-build python=${{ matrix.python }} -c anaconda
- shell: bash -l {0}
- - name: Activate environment
- shell: bash -l {0}
- run: |
- echo "micromamba activate env" >> ~/.profile
- echo "==== .profile ====="
- cat ~/.profile
- - run: which python; which gcc
- shell: bash -l {0}
- - name: Setup Runner
- uses: ./.github/actions/setup-build-cuda
- with:
- toolkit_type: cuda
- toolkit_short_version: ${{ matrix.config.cuda_short_version }}
- python: ${{ matrix.python }}
- - name: Define version
- shell: bash -l {0}
- env:
- VERSION_SOURCE: ${{ github.ref_type == 'tag' && 'tag' || 'dev' }}
- run: |
- set -Eeuo pipefail
- git config --global --add safe.directory "$(pwd)"
- git rev-parse --short HEAD
- python -m pip install packaging
- version=`python packaging/compute_wheel_version.py --source $VERSION_SOURCE`
- echo "BUILD_VERSION=$version" >> ${GITHUB_ENV}
- cat ${GITHUB_ENV}
- - name: Build & store/upload
- shell: bash -l {0}
- env:
- # NOTE: Ternary operator: ${{ cond && 'trueVal' || 'falseVal' }}
- STORE_PT_PACKAGE: ${{ matrix.config.torch_channel != 'pytorch' && '--store-pytorch-package' || '' }}
- run: |
- anaconda upload --help
- python packaging/build_conda.py \
- --cuda ${{ matrix.config.cuda_version }} \
- --python ${{ matrix.python }} \
- --pytorch ${{ matrix.config.torch_version }} \
- --pytorch-channel ${{ matrix.config.torch_channel }} \
- --cuda-dep-runtime "${{ matrix.config.cuda_dep_runtime }}" \
- --store $STORE_PT_PACKAGE
- - name: Upload
- shell: bash -l {0}
- if: github.repository == 'facebookresearch/xformers' && github.event_name != 'pull_request' && matrix.config.torch_channel == 'pytorch'
- env:
- ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
- run: |
- # This might fail, let's retry it multiple times
- for i in {1..20}
- do
- [[ $i != 1 ]] && sleep 15
- echo "Attempt $i"
- anaconda upload --user xformers --label ${XFORMERS_CONDA_TAG} packages/* && break
- done
- - uses: actions/upload-artifact@v4
- if: success() || failure()
- with:
- name: linux-py${{ matrix.python }}-torch${{ matrix.config.torch_version }}-cu${{ matrix.config.cuda_short_version }}
- path: packages
-# Note: it might be helpful to have additional steps that test if the built wheels actually work
diff --git a/.github/workflows/rocm_build.yml b/.github/workflows/rocm_build.yml
index 8d3751c6f1..8c8bd9b081 100644
--- a/.github/workflows/rocm_build.yml
+++ b/.github/workflows/rocm_build.yml
@@ -6,7 +6,7 @@ on:
- develop
pull_request:
paths:
- - "packaging/compute_wheel_version.sh"
+ - ".github/compute_wheel_version.py"
- ".github/workflows/rocm_build.yml"
- ".github/workflows/wheels_build.yml"
- "setup.py"
diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml
index e1ba745b0f..db6ba6572a 100644
--- a/.github/workflows/wheels.yml
+++ b/.github/workflows/wheels.yml
@@ -3,7 +3,7 @@ name: wheels
on:
pull_request:
paths:
- - "packaging/compute_wheel_version.sh"
+ - ".github/compute_wheel_version.py"
- ".github/workflows/wheel*"
- ".github/actions/setup-build-cuda/action.yml"
- "setup.py"
diff --git a/.github/workflows/wheels_build.yml b/.github/workflows/wheels_build.yml
index 13ad3c7713..4e9e1ccd50 100644
--- a/.github/workflows/wheels_build.yml
+++ b/.github/workflows/wheels_build.yml
@@ -93,7 +93,7 @@ jobs:
run: |
set -Eeuo pipefail
git config --global --add safe.directory "*"
- version=`python packaging/compute_wheel_version.py --source $VERSION_SOURCE`
+ version=`python .github/compute_wheel_version.py --source $VERSION_SOURCE`
echo $version > version.txt
echo "BUILD_VERSION=$version${{ steps.cuda_info.outputs.CUDA_VERSION_SUFFIX }}" >> ${GITHUB_ENV}
echo "BUILD_VERSION=$version${{ steps.cuda_info.outputs.CUDA_VERSION_SUFFIX }}" >> ${GITHUB_OUTPUT}
diff --git a/.github/workflows/wheels_upload_pip.yml b/.github/workflows/wheels_upload_pip.yml
index a4a4c2a015..a46ee5017a 100644
--- a/.github/workflows/wheels_upload_pip.yml
+++ b/.github/workflows/wheels_upload_pip.yml
@@ -86,7 +86,7 @@ jobs:
env:
VERSION_SOURCE: ${{ github.ref_type == 'tag' && 'tag' || 'dev' }}
run: |
- version=`$PY packaging/compute_wheel_version.py --source $VERSION_SOURCE`
+ version=`$PY .github/compute_wheel_version.py --source $VERSION_SOURCE`
echo $version > version.txt
cat version.txt
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eafdcd4021..d48ff31e5f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [0.0.28.post3] - TBD
+### Removed:
+- Following PyTorch, xFormers no longer builds binaries for conda. Pip is now the only recommended way to get xFormers
+
## [0.0.28.post3] - 2024-10-30
Pre-built binary wheels require PyTorch 2.5.1
diff --git a/README.md b/README.md
index 27b414c8de..37850ecda9 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,5 @@
-![Install with conda](https://anaconda.org/xformers/xformers/badges/installer/conda.svg)
-![Downloads](https://anaconda.org/xformers/xformers/badges/downloads.svg)
-![License](https://anaconda.org/xformers/xformers/badges/license.svg)
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/facebookresearch/xformers/blob/main/docs/source/xformers_mingpt.ipynb)