Skip to content

Commit

Permalink
Merge pull request #73 from teddykoker/prebuilt-wheel-names
Browse files Browse the repository at this point in the history
Prebuilt release naming convention
  • Loading branch information
teddykoker committed Jul 26, 2023
2 parents 523829c + b9e04fe commit 6bf7968
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ jobs:
os: [ubuntu-20.04]
python-version: ['3.10', '3.11']
torch-version: ['1.13.1', '2.0.1']
cuda-version: ['cpu', 'cu113', 'cu117', 'cu118']
cuda-version: ['cpu', 'cu117', 'cu118']
exclude:
- torch-version: 1.13.1
cuda-version: cu118
- torch-version: 2.0.1
cuda-version: cu113
steps:
- name: Free disk space
run: |
Expand Down Expand Up @@ -57,6 +55,9 @@ jobs:
run: |
export FORCE_CUDA=1
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6"
TORCH_VERSION=`echo "pt${{ matrix.torch-version }}" | sed "s/^\([0-9]\+\.[0-9]\+\).*$/\1/" | sed "s/\.//g"`
CUDA_VERSION=`echo ${{ matrix.cuda-version }}`
export TORCHSORT_VERSION_SUFFIX="+$TORCH_VERSION$CUDA_VERSION"
python3 -m pip install wheel
python3 setup.py bdist_wheel --dist-dir=dist
echo "distname=$(ls dist)" >> ${GITHUB_OUTPUT}
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,31 @@ environments. If this happens you may need to:
Thanks to @levnikmyskin, @sachit-menon for pointing this out!
</details>

### Pre-built Wheels

Pre-built wheels are currently available on Linux for some Python/PyTorch/CUDA combinations:

```bash
# torchsort version, supports >= 1.9.0
export TORCHSORT=1.9.0
# PyTorch version, supports pt20 and pt113 for versions 2.0 and 1.13 respectively
export TORCH=pt20
# CUDA version, supports cpu, cu113, cu117, cu118 for CPU-only, CUDA 11.3, CUDA 11.7 and CUDA 11.8 respectively
export CUDA=cu118
# Python version, supports cp310 and cp311 for versions 3.10 and 3.11 respectively
export PYTHON=cp310

pip install https://github.com/teddykoker/torchsort/releases/download/v${TORCHSORT}/torchsort-${TORCHSORT}+${TORCH}${CUDA}-${PYTHON}-${PYTHON}-linux_x86_64.whl
```



## Usage

`torchsort` exposes two functions: `soft_rank` and `soft_sort`, each with
parameters `regularization` (`"l2"` or `"kl"`) and `regularization_strength` (a
scalar value). Each will rank/sort the last dimension of a 2-d tensor, with an
accuracy dependant upon the regularization strength:
accuracy dependent upon the regularization strength:

```python
import torch
Expand Down

0 comments on commit 6bf7968

Please sign in to comment.