Compare commits

...

18 Commits

Author SHA1 Message Date
Fangjun Kuang
9165e73a3b
Support torch 2.8.0 (#120) 2025-08-07 21:09:15 +08:00
Fangjun Kuang
8cda08e0c5
support torch 2.7.1 (#119) 2025-06-05 11:30:38 +08:00
Fangjun Kuang
6edd6a8370
support torch 2.7.0 (#118) 2025-06-05 10:47:36 +08:00
Fangjun Kuang
0ecdee6e88
Support Linux arm64 (#114) 2025-03-07 14:22:18 +08:00
Fangjun Kuang
3f79fbbd6d
Support torch 2.6.0 (#112) 2025-01-30 08:45:49 +08:00
Fangjun Kuang
c1aefb643e
Support numpy 2 0 and torch 2.5.1 (#110) 2024-10-30 12:45:45 +08:00
Fangjun Kuang
e485c5749b
Support torch 2.5.0 (#109) 2024-10-18 11:04:11 +08:00
Fangjun Kuang
e05540cfad
Allow all zero rows in mel computation matrix. (#107) 2024-09-14 12:02:20 +08:00
Fangjun Kuang
5f9602afab
support for torch 2.4.1 (#106) 2024-09-07 17:32:29 +08:00
Fangjun Kuang
a39a011de9
Update readme for how to install kaldifeat (#105) 2024-08-09 14:55:47 +08:00
Karel Vesely
eeefc87660
switch C++14 -> C++17, so it becomes compatible with Pytorch 2.4 (#103) 2024-08-01 06:45:02 +08:00
Fangjun Kuang
0355ed8ced
support torch2.4.0 (#102) 2024-07-25 15:17:44 +08:00
Fangjun Kuang
f36767ed1d
support torch 2.3.1 (#100) 2024-06-06 11:00:41 +08:00
Fangjun Kuang
40cc0a4a2c
Support torch 2.3.0 (#99) 2024-04-25 21:28:17 +08:00
Fangjun Kuang
843763fd05
support torch 2.2.2 (#98) 2024-04-25 20:49:43 +08:00
Fangjun Kuang
5dee672556
support torch 2.2.1 (#96) 2024-02-23 13:48:33 +08:00
Fangjun Kuang
2a8a993f15
Fix building wheels for torch 2.2.0. (#95)
See also https://github.com/pytorch/pytorch/issues/120020
2024-02-18 20:30:18 +08:00
Fangjun Kuang
2e042b356e
Support torch 2.2.0 (#94) 2024-02-10 21:27:19 +08:00
27 changed files with 1123 additions and 257 deletions

View File

@ -54,6 +54,7 @@ jobs:
ls -lh $KALDIFEAT_DIR ls -lh $KALDIFEAT_DIR
export GIT_LFS_SKIP_SMUDGE=1 export GIT_LFS_SKIP_SMUDGE=1
export GIT_CLONE_PROTECTION_ACTIVE=false
git clone https://huggingface.co/csukuangfj/kaldifeat huggingface git clone https://huggingface.co/csukuangfj/kaldifeat huggingface
cd huggingface cd huggingface
@ -68,6 +69,8 @@ jobs:
make html make html
cp source/cpu.html build/html/ cp source/cpu.html build/html/
cp source/cuda.html build/html/ cp source/cuda.html build/html/
cp source/cpu-cn.html build/html/
cp source/cuda-cn.html build/html/
touch build/html/.nojekyll touch build/html/.nojekyll
- name: Deploy - name: Deploy

View File

@ -3,7 +3,8 @@ name: build-wheels-cpu-macos
on: on:
push: push:
branches: branches:
- fix-wheel # - wheel
- torch-2.8.0
tags: tags:
- '*' - '*'
workflow_dispatch: workflow_dispatch:
@ -26,14 +27,17 @@ jobs:
id: set-matrix id: set-matrix
run: | run: |
# outputting for debugging purposes # outputting for debugging purposes
python ./scripts/github_actions/generate_build_matrix.py --for-macos # python ./scripts/github_actions/generate_build_matrix.py --for-macos
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-macos) # MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-macos)
python ./scripts/github_actions/generate_build_matrix.py --for-macos --test-only-latest-torch
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-macos --test-only-latest-torch)
echo "::set-output name=matrix::${MATRIX}" echo "::set-output name=matrix::${MATRIX}"
build_wheels_macos_cpu: build_wheels_macos_cpu:
needs: generate_build_matrix needs: generate_build_matrix
name: ${{ matrix.torch }} ${{ matrix.python-version }} name: ${{ matrix.torch }} ${{ matrix.python-version }}
runs-on: macos-latest runs-on: macos-14
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -44,23 +48,44 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
# see https://cibuildwheel.readthedocs.io/en/stable/changelog/ - name: Setup Python
# for a list of versions uses: actions/setup-python@v5
- name: Build wheels with:
uses: pypa/cibuildwheel@v2.11.4 python-version: ${{ matrix.python-version }}
env:
CIBW_BEFORE_BUILD: pip install torch==${{ matrix.torch}} cmake numpy
CIBW_BUILD: ${{ matrix.python-version }}-*
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
CIBW_BUILD_VERBOSITY: 3
- name: Display wheels - name: Install dependencies
shell: bash
run: |
pip install -q torch==${{ matrix.torch}} cmake numpy wheel>=0.40.0 twine setuptools
- name: Build wheel
shell: bash
run: |
python3 setup.py bdist_wheel
mkdir wheelhouse
cp -v dist/* wheelhouse
- name: Display wheels (before fix)
shell: bash
run: |
ls -lh ./wheelhouse/
- name: Fix wheel platform tag
run: |
# See https://github.com/glencoesoftware/zeroc-ice-py-macos-x86_64/pull/3/files
# See:
# * https://github.com/pypa/wheel/issues/406
python -m wheel tags \
--platform-tag=macosx_11_0_arm64 \
--remove wheelhouse/*.whl
- name: Display wheels (after fix)
shell: bash shell: bash
run: | run: |
ls -lh ./wheelhouse/ ls -lh ./wheelhouse/
- name: Upload Wheel - name: Upload Wheel
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-macos-latest-cpu name: torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-macos-latest-cpu
path: wheelhouse/*.whl path: wheelhouse/*.whl
@ -86,8 +111,9 @@ jobs:
cd huggingface cd huggingface
git pull git pull
mkdir -p macos d=cpu/1.25.5.dev20241029/macos
cp -v ../wheelhouse/*.whl ./macos mkdir -p $d
cp -v ../wheelhouse/*.whl ./$d
git status git status
git lfs track "*.whl" git lfs track "*.whl"
git add . git add .

View File

@ -66,7 +66,7 @@ jobs:
run: | run: |
python3 -m pip install -qq --upgrade pip python3 -m pip install -qq --upgrade pip
python3 -m pip install -qq wheel twine typing_extensions soundfile numpy python3 -m pip install -qq wheel twine typing_extensions soundfile numpy
python3 -m pip install -qq torch==${{ matrix.torch }} -f https://download.pytorch.org/whl/torch_stable.html python3 -m pip install -qq torch==${{ matrix.torch }} -f https://download.pytorch.org/whl/torch_stable.html || python3 -m pip install -qq torch==${{ matrix.torch }} -f https://download.pytorch.org/whl/torch/
python3 -c "import torch; print('torch version:', torch.__version__)" python3 -c "import torch; print('torch version:', torch.__version__)"

View File

@ -69,7 +69,7 @@ jobs:
python3 -m pip install --upgrade pip python3 -m pip install --upgrade pip
python3 -m pip install wheel twine typing_extensions soundfile python3 -m pip install wheel twine typing_extensions soundfile
python3 -m pip install bs4 requests tqdm numpy python3 -m pip install bs4 requests tqdm numpy
python3 -m pip install -qq torch==${{ matrix.torch }}+cpu -f https://download.pytorch.org/whl/torch_stable.html python3 -m pip install -qq torch==${{ matrix.torch }}+cpu -f https://download.pytorch.org/whl/torch_stable.html || python3 -m pip install -qq torch==${{ matrix.torch }}+cpu -f https://download.pytorch.org/whl/torch/
python3 -c "import torch; print('torch version:', torch.__version__)" python3 -c "import torch; print('torch version:', torch.__version__)"

View File

@ -71,7 +71,7 @@ jobs:
- name: Install PyTorch ${{ matrix.torch }} - name: Install PyTorch ${{ matrix.torch }}
run: | run: |
pip3 install -qq torch==${{ matrix.torch }}+cpu -f https://download.pytorch.org/whl/torch_stable.html pip3 install -qq torch==${{ matrix.torch }}+cpu -f https://download.pytorch.org/whl/torch_stable.html || pip3 install -qq torch==${{ matrix.torch }}+cpu -f https://download.pytorch.org/whl/torch/
pip3 install -qq wheel twine dataclasses numpy typing_extensions soundfile pip3 install -qq wheel twine dataclasses numpy typing_extensions soundfile
- name: Display CMake version - name: Display CMake version
@ -107,7 +107,7 @@ jobs:
python3 -c "import kaldifeat; print(kaldifeat.__version__)" python3 -c "import kaldifeat; print(kaldifeat.__version__)"
- name: Upload Wheel - name: Upload Wheel
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: python-${{ matrix.python-version }}-${{ matrix.os }}-cpu name: python-${{ matrix.python-version }}-${{ matrix.os }}-cpu
path: dist/*.whl path: dist/*.whl

View File

@ -113,7 +113,7 @@ jobs:
python3 -m pip install -qq --upgrade pip python3 -m pip install -qq --upgrade pip
python3 -m pip install -qq wheel twine numpy typing_extensions python3 -m pip install -qq wheel twine numpy typing_extensions
python3 -m pip install -qq dataclasses soundfile numpy python3 -m pip install -qq dataclasses soundfile numpy
python3 -m pip install -qq torch==${{ matrix.torch }}${v} -f https://download.pytorch.org/whl/torch_stable.html numpy python3 -m pip install -qq torch==${{ matrix.torch }}${v} -f https://download.pytorch.org/whl/torch_stable.html numpy || python3 -m pip install -qq torch==${{ matrix.torch }}${v} -f https://download.pytorch.org/whl/torch/ numpy
python3 -c "import torch; print('torch version:', torch.__version__)" python3 -c "import torch; print('torch version:', torch.__version__)"
@ -159,7 +159,7 @@ jobs:
python3 -c "import kaldifeat; print(kaldifeat.__version__)" python3 -c "import kaldifeat; print(kaldifeat.__version__)"
- name: Upload Wheel - name: Upload Wheel
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: python-${{ matrix.python-version }}-${{ matrix.os }}-cuda-${{ matrix.cuda }} name: python-${{ matrix.python-version }}-${{ matrix.os }}-cuda-${{ matrix.cuda }}
path: dist/*.whl path: dist/*.whl

View File

@ -47,7 +47,7 @@ jobs:
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'windows') if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'windows')
shell: bash shell: bash
run: | run: |
pip install torch==${{ github.event.inputs.torch_version }}+cpu -f https://download.pytorch.org/whl/torch_stable.html pip install torch==${{ github.event.inputs.torch_version }}+cpu -f https://download.pytorch.org/whl/torch_stable.html || pip install torch==${{ github.event.inputs.torch_version }}+cpu -f https://download.pytorch.org/whl/torch/
- name: Install kaldifeat - name: Install kaldifeat
shell: bash shell: bash

View File

@ -0,0 +1,168 @@
name: build-wheels-cpu-arm64-ubuntu
on:
push:
branches:
# - wheel
- torch-2.8.0
tags:
- '*'
workflow_dispatch:
concurrency:
group: build-wheels-cpu-arm64-ubuntu-${{ github.ref }}
cancel-in-progress: true
jobs:
generate_build_matrix:
# see https://github.com/pytorch/pytorch/pull/50633
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generating build matrix
id: set-matrix
run: |
# outputting for debugging purposes
# python ./scripts/github_actions/generate_build_matrix.py --for-arm64
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-arm64)
python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch --for-arm64
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch --for-arm64)
echo "::set-output name=matrix::${MATRIX}"
build-manylinux-wheels:
needs: generate_build_matrix
name: ${{ matrix.torch }} ${{ matrix.python-version }}
runs-on: ubuntu-22.04-arm
strategy:
fail-fast: false
matrix:
${{ fromJson(needs.generate_build_matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# see https://github.com/pytorch/test-infra/blob/9e3d392690719fac85bad0c9b67f530e48375ca1/tools/scripts/generate_binary_build_matrix.py
# https://github.com/pytorch/builder/tree/main/manywheel
# https://github.com/pytorch/builder/pull/476
# https://github.com/k2-fsa/k2/issues/733
# https://github.com/pytorch/pytorch/pull/50633 (generate build matrix)
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
with:
image: ${{ matrix.image }}
options: -v ${{ github.workspace }}:/var/www -e IS_2_28=${{ matrix.is_2_28 }} -e PYTHON_VERSION=${{ matrix.python-version }} -e TORCH_VERSION=${{ matrix.torch }}
run: |
echo "pwd: $PWD"
uname -a
id
cat /etc/*release
gcc --version
python3 --version
which python3
ls -lh /opt/python/
echo "---"
ls -lh /opt/python/cp*
ls -lh /opt/python/*/bin
echo "---"
find /opt/python/cp* -name "libpython*"
echo "-----"
find /opt/_internal/cp* -name "libpython*"
echo "-----"
find / -name "libpython*"
echo "----"
ls -lh /usr/lib64/libpython3.so
# cp36-cp36m
# cp37-cp37m
# cp38-cp38
# cp39-cp39
# cp310-cp310
# cp311-cp311
# cp312-cp312
# cp313-cp313
# cp313-cp313t (no gil)
if [[ $PYTHON_VERSION == "3.6" ]]; then
python_dir=/opt/python/cp36-cp36m
export PYTHONPATH=/opt/python/cp36-cp36m/lib/python3.6/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.7" ]]; then
python_dir=/opt/python/cp37-cp37m
export PYTHONPATH=/opt/python/cp37-cp37m/lib/python3.7/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.8" ]]; then
python_dir=/opt/python/cp38-cp38
export PYTHONPATH=/opt/python/cp38-cp38/lib/python3.8/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.9" ]]; then
python_dir=/opt/python/cp39-cp39
export PYTHONPATH=/opt/python/cp39-cp39/lib/python3.9/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.10" ]]; then
python_dir=/opt/python/cp310-cp310
export PYTHONPATH=/opt/python/cp310-cp310/lib/python3.10/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.11" ]]; then
python_dir=/opt/python/cp311-cp311
export PYTHONPATH=/opt/python/cp311-cp311/lib/python3.11/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.12" ]]; then
python_dir=/opt/python/cp312-cp312
export PYTHONPATH=/opt/python/cp312-cp312/lib/python3.12/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.13" ]]; then
python_dir=/opt/python/cp313-cp313
export PYTHONPATH=/opt/python/cp313-cp313/lib/python3.13/site-packages:$PYTHONPATH
else
echo "Unsupported Python version $PYTHON_VERSION"
exit 1
fi
export PYTHON_INSTALL_DIR=$python_dir
export PATH=$PYTHON_INSTALL_DIR/bin:$PATH
python3 --version
which python3
/var/www/scripts/github_actions/build-ubuntu-cpu-arm64.sh
- name: Display wheels
shell: bash
run: |
ls -lh ./wheelhouse/
# https://huggingface.co/docs/hub/spaces-github-actions
- name: Publish to huggingface
if: github.repository_owner == 'csukuangfj'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
with:
max_attempts: 20
timeout_seconds: 200
shell: bash
command: |
git config --global user.email "csukuangfj@gmail.com"
git config --global user.name "Fangjun Kuang"
rm -rf huggingface
export GIT_LFS_SKIP_SMUDGE=1
git clone https://huggingface.co/csukuangfj/kaldifeat huggingface
cd huggingface
git pull
d=cpu/1.25.5.dev20250307/linux-arm64
mkdir -p $d
cp -v ../wheelhouse/*.whl ./$d
git status
git lfs track "*.whl"
git add .
git commit -m "upload ubuntu-arm64-cpu wheel for torch ${{ matrix.torch }} python ${{ matrix.python-version }}"
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/kaldifeat main

View File

@ -3,7 +3,8 @@ name: build-wheels-cpu-ubuntu
on: on:
push: push:
branches: branches:
- fix-wheel # - wheel
- torch-2.8.0
tags: tags:
- '*' - '*'
workflow_dispatch: workflow_dispatch:
@ -26,8 +27,11 @@ jobs:
id: set-matrix id: set-matrix
run: | run: |
# outputting for debugging purposes # outputting for debugging purposes
python ./scripts/github_actions/generate_build_matrix.py # python ./scripts/github_actions/generate_build_matrix.py
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py) # MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py)
python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch)
echo "::set-output name=matrix::${MATRIX}" echo "::set-output name=matrix::${MATRIX}"
build-manylinux-wheels: build-manylinux-wheels:
@ -53,7 +57,7 @@ jobs:
uses: addnab/docker-run-action@v3 uses: addnab/docker-run-action@v3
with: with:
image: ${{ matrix.image }} image: ${{ matrix.image }}
options: -v ${{ github.workspace }}:/var/www -e PYTHON_VERSION=${{ matrix.python-version }} -e TORCH_VERSION=${{ matrix.torch }} options: -v ${{ github.workspace }}:/var/www -e IS_2_28=${{ matrix.is_2_28 }} -e PYTHON_VERSION=${{ matrix.python-version }} -e TORCH_VERSION=${{ matrix.torch }}
run: | run: |
echo "pwd: $PWD" echo "pwd: $PWD"
uname -a uname -a
@ -62,6 +66,69 @@ jobs:
gcc --version gcc --version
python3 --version python3 --version
which python3 which python3
ls -lh /opt/python/
echo "---"
ls -lh /opt/python/cp*
ls -lh /opt/python/*/bin
echo "---"
find /opt/python/cp* -name "libpython*"
echo "-----"
find /opt/_internal/cp* -name "libpython*"
echo "-----"
find / -name "libpython*"
echo "----"
ls -lh /usr/lib64/libpython3.so || true
# cp36-cp36m
# cp37-cp37m
# cp38-cp38
# cp39-cp39
# cp310-cp310
# cp311-cp311
# cp312-cp312
# cp313-cp313
# cp313-cp313t (no gil)
if [[ $PYTHON_VERSION == "3.6" ]]; then
python_dir=/opt/python/cp36-cp36m
export PYTHONPATH=/opt/python/cp36-cp36m/lib/python3.6/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.7" ]]; then
python_dir=/opt/python/cp37-cp37m
export PYTHONPATH=/opt/python/cp37-cp37m/lib/python3.7/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.8" ]]; then
python_dir=/opt/python/cp38-cp38
export PYTHONPATH=/opt/python/cp38-cp38/lib/python3.8/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.9" ]]; then
python_dir=/opt/python/cp39-cp39
export PYTHONPATH=/opt/python/cp39-cp39/lib/python3.9/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.10" ]]; then
python_dir=/opt/python/cp310-cp310
export PYTHONPATH=/opt/python/cp310-cp310/lib/python3.10/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.11" ]]; then
python_dir=/opt/python/cp311-cp311
export PYTHONPATH=/opt/python/cp311-cp311/lib/python3.11/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.12" ]]; then
python_dir=/opt/python/cp312-cp312
export PYTHONPATH=/opt/python/cp312-cp312/lib/python3.12/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.13" ]]; then
python_dir=/opt/python/cp313-cp313
export PYTHONPATH=/opt/python/cp313-cp313/lib/python3.13/site-packages:$PYTHONPATH
else
echo "Unsupported Python version $PYTHON_VERSION"
exit 1
fi
export PYTHON_INSTALL_DIR=$python_dir
export PATH=$PYTHON_INSTALL_DIR/bin:$PATH
python3 --version
which python3
/var/www/scripts/github_actions/build-ubuntu-cpu.sh /var/www/scripts/github_actions/build-ubuntu-cpu.sh
- name: Display wheels - name: Display wheels
@ -69,12 +136,6 @@ jobs:
run: | run: |
ls -lh ./wheelhouse/ ls -lh ./wheelhouse/
- name: Upload Wheel
uses: actions/upload-artifact@v2
with:
name: torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-ubuntu-latest-cpu
path: wheelhouse/*.whl
# https://huggingface.co/docs/hub/spaces-github-actions # https://huggingface.co/docs/hub/spaces-github-actions
- name: Publish to huggingface - name: Publish to huggingface
if: github.repository_owner == 'csukuangfj' if: github.repository_owner == 'csukuangfj'
@ -97,8 +158,9 @@ jobs:
cd huggingface cd huggingface
git pull git pull
mkdir -p ubuntu-cpu d=cpu/1.25.5.dev20250307/linux-x64
cp -v ../wheelhouse/*.whl ./ubuntu-cpu mkdir -p $d
cp -v ../wheelhouse/*.whl ./$d
git status git status
git lfs track "*.whl" git lfs track "*.whl"
git add . git add .

View File

@ -3,7 +3,8 @@ name: build-wheels-cuda-ubuntu
on: on:
push: push:
branches: branches:
- fix-wheel - wheel
# - torch-2.7.1
tags: tags:
- '*' - '*'
workflow_dispatch: workflow_dispatch:
@ -26,8 +27,11 @@ jobs:
id: set-matrix id: set-matrix
run: | run: |
# outputting for debugging purposes # outputting for debugging purposes
python ./scripts/github_actions/generate_build_matrix.py --enable-cuda # python ./scripts/github_actions/generate_build_matrix.py --enable-cuda
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda) # MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda)
python ./scripts/github_actions/generate_build_matrix.py --enable-cuda --test-only-latest-torch
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda --test-only-latest-torch)
echo "::set-output name=matrix::${MATRIX}" echo "::set-output name=matrix::${MATRIX}"
build-manylinux-wheels: build-manylinux-wheels:
@ -44,6 +48,15 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Free space
shell: bash
run: |
df -h
rm -rf /opt/hostedtoolcache
df -h
echo "pwd: $PWD"
echo "github.workspace ${{ github.workspace }}"
# see https://github.com/pytorch/test-infra/blob/9e3d392690719fac85bad0c9b67f530e48375ca1/tools/scripts/generate_binary_build_matrix.py # see https://github.com/pytorch/test-infra/blob/9e3d392690719fac85bad0c9b67f530e48375ca1/tools/scripts/generate_binary_build_matrix.py
# https://github.com/pytorch/builder/tree/main/manywheel # https://github.com/pytorch/builder/tree/main/manywheel
# https://github.com/pytorch/builder/pull/476 # https://github.com/pytorch/builder/pull/476
@ -53,7 +66,7 @@ jobs:
uses: addnab/docker-run-action@v3 uses: addnab/docker-run-action@v3
with: with:
image: ${{ matrix.image }} image: ${{ matrix.image }}
options: -v ${{ github.workspace }}:/var/www -e PYTHON_VERSION=${{ matrix.python-version }} -e TORCH_VERSION=${{ matrix.torch }} -e CUDA_VERSION=${{ matrix.cuda }} options: -v ${{ github.workspace }}:/var/www -e IS_2_28=${{ matrix.is_2_28 }} -e PYTHON_VERSION=${{ matrix.python-version }} -e TORCH_VERSION=${{ matrix.torch }} -e CUDA_VERSION=${{ matrix.cuda }}
run: | run: |
echo "pwd: $PWD" echo "pwd: $PWD"
uname -a uname -a
@ -63,6 +76,69 @@ jobs:
python3 --version python3 --version
which python3 which python3
ls -lh /opt/python/
echo "---"
ls -lh /opt/python/cp*
ls -lh /opt/python/*/bin
echo "---"
find /opt/python/cp* -name "libpython*"
echo "-----"
find /opt/_internal/cp* -name "libpython*"
echo "-----"
find / -name "libpython*"
# cp36-cp36m
# cp37-cp37m
# cp38-cp38
# cp39-cp39
# cp310-cp310
# cp311-cp311
# cp312-cp312
# cp313-cp313
# cp313-cp313t (no gil)
if [[ $PYTHON_VERSION == "3.6" ]]; then
python_dir=/opt/python/cp36-cp36m
export PYTHONPATH=/opt/python/cp36-cp36m/lib/python3.6/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.7" ]]; then
python_dir=/opt/python/cp37-cp37m
export PYTHONPATH=/opt/python/cp37-cp37m/lib/python3.7/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.8" ]]; then
python_dir=/opt/python/cp38-cp38
export PYTHONPATH=/opt/python/cp38-cp38/lib/python3.8/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.9" ]]; then
python_dir=/opt/python/cp39-cp39
export PYTHONPATH=/opt/python/cp39-cp39/lib/python3.9/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.10" ]]; then
python_dir=/opt/python/cp310-cp310
export PYTHONPATH=/opt/python/cp310-cp310/lib/python3.10/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.11" ]]; then
python_dir=/opt/python/cp311-cp311
export PYTHONPATH=/opt/python/cp311-cp311/lib/python3.11/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.12" ]]; then
python_dir=/opt/python/cp312-cp312
export PYTHONPATH=/opt/python/cp312-cp312/lib/python3.12/site-packages:$PYTHONPATH
elif [[ $PYTHON_VERSION == "3.13" ]]; then
python_dir=/opt/python/cp313-cp313
export PYTHONPATH=/opt/python/cp313-cp313/lib/python3.13/site-packages:$PYTHONPATH
else
echo "Unsupported Python version $PYTHON_VERSION"
exit 1
fi
export PYTHON_INSTALL_DIR=$python_dir
export PATH=$PYTHON_INSTALL_DIR/bin:$PATH
# There are no libpython.so inside $PYTHON_INSTALL_DIR
# since they are statically linked.
python3 --version
which python3
pushd /usr/local pushd /usr/local
rm cuda rm cuda
ln -s cuda-$CUDA_VERSION cuda ln -s cuda-$CUDA_VERSION cuda
@ -81,9 +157,10 @@ jobs:
ls -lh ./wheelhouse/ ls -lh ./wheelhouse/
- name: Upload Wheel - name: Upload Wheel
uses: actions/upload-artifact@v3 if: false
uses: actions/upload-artifact@v4
with: with:
name: torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-ubuntu-latest-cuda name: torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-ubuntu-latest-cuda-is_2_28-${{ matrix.is_2_28 }}
path: wheelhouse/*.whl path: wheelhouse/*.whl
# https://huggingface.co/docs/hub/spaces-github-actions # https://huggingface.co/docs/hub/spaces-github-actions
@ -107,8 +184,9 @@ jobs:
cd huggingface cd huggingface
git pull git pull
mkdir -p ubuntu-cuda d=cuda/1.25.5.dev20241029/linux
cp -v ../wheelhouse/*.whl ./ubuntu-cuda mkdir -p $d
cp -v ../wheelhouse/*.whl ./$d
git status git status
git lfs track "*.whl" git lfs track "*.whl"
git add . git add .

View File

@ -3,7 +3,8 @@ name: build-wheels-cpu-win64
on: on:
push: push:
branches: branches:
- fix-wheel # - wheel
- torch-2.8.0
tags: tags:
- '*' - '*'
workflow_dispatch: workflow_dispatch:
@ -26,8 +27,11 @@ jobs:
id: set-matrix id: set-matrix
run: | run: |
# outputting for debugging purposes # outputting for debugging purposes
python ./scripts/github_actions/generate_build_matrix.py --for-windows # python ./scripts/github_actions/generate_build_matrix.py --for-windows
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-windows) # MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-windows)
python ./scripts/github_actions/generate_build_matrix.py --for-windows --test-only-latest-torch
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-windows --test-only-latest-torch)
echo "::set-output name=matrix::${MATRIX}" echo "::set-output name=matrix::${MATRIX}"
build_wheels_win64_cpu: build_wheels_win64_cpu:
@ -44,15 +48,23 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
# see https://cibuildwheel.readthedocs.io/en/stable/changelog/ - name: Setup Python
# for a list of versions uses: actions/setup-python@v5
- name: Build wheels with:
uses: pypa/cibuildwheel@v2.11.4 python-version: ${{ matrix.python-version }}
env:
CIBW_BEFORE_BUILD: pip install torch==${{ matrix.torch}}+cpu -f https://download.pytorch.org/whl/torch_stable.html cmake numpy - name: Install dependencies
CIBW_BUILD: ${{ matrix.python-version }}-win_amd64 shell: bash
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "" run: |
CIBW_BUILD_VERBOSITY: 3 pip install -q torch==${{ matrix.torch}} cmake numpy wheel>=0.40.0 twine setuptools
pip install torch==${{ matrix.torch}}+cpu -f https://download.pytorch.org/whl/torch_stable.html cmake numpy || pip install torch==${{ matrix.torch}}+cpu -f https://download.pytorch.org/whl/torch/ cmake numpy
- name: Build wheel
shell: bash
run: |
python3 setup.py bdist_wheel
mkdir wheelhouse
cp -v dist/* wheelhouse
- name: Display wheels - name: Display wheels
shell: bash shell: bash
@ -60,7 +72,7 @@ jobs:
ls -lh ./wheelhouse/ ls -lh ./wheelhouse/
- name: Upload Wheel - name: Upload Wheel
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-windows-latest-cpu name: torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-windows-latest-cpu
path: wheelhouse/*.whl path: wheelhouse/*.whl
@ -86,8 +98,9 @@ jobs:
cd huggingface cd huggingface
git pull git pull
mkdir -p windows-cpu d=cpu/1.25.5.dev20241029/windows
cp -v ../wheelhouse/*.whl ./windows-cpu mkdir -p $d
cp -v ../wheelhouse/*.whl ./$d
git status git status
git lfs track "*.whl" git lfs track "*.whl"
git add . git add .

2
.gitignore vendored
View File

@ -6,3 +6,5 @@ __pycache__/
test-1hour.wav test-1hour.wav
path.sh path.sh
torch_version.py torch_version.py
cpu*.html
cuda*.html

View File

@ -1,4 +1,7 @@
# Copyright (c) 2021 Xiaomi Corporation (author: Fangjun Kuang) # Copyright (c) 2021 Xiaomi Corporation (author: Fangjun Kuang)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "4.0.0")
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
endif()
cmake_minimum_required(VERSION 3.8 FATAL_ERROR) cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
@ -7,7 +10,7 @@ project(kaldifeat)
# remember to change the version in # remember to change the version in
# scripts/conda/kaldifeat/meta.yaml # scripts/conda/kaldifeat/meta.yaml
# scripts/conda-cpu/kaldifeat/meta.yaml # scripts/conda-cpu/kaldifeat/meta.yaml
set(kaldifeat_VERSION "1.25.4") set(kaldifeat_VERSION "1.25.5")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
@ -17,6 +20,7 @@ set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(BUILD_RPATH_USE_ORIGIN TRUE) set(BUILD_RPATH_USE_ORIGIN TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if(NOT APPLE) if(NOT APPLE)
set(kaldifeat_rpath_origin "$ORIGIN") set(kaldifeat_rpath_origin "$ORIGIN")
else() else()
@ -33,7 +37,7 @@ if(NOT CMAKE_BUILD_TYPE)
endif() endif()
if (NOT CMAKE_CXX_STANDARD) if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ version to be used.") set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ version to be used.")
endif() endif()
message(STATUS "C++ Standard version: ${CMAKE_CXX_STANDARD}") message(STATUS "C++ Standard version: ${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
@ -42,10 +46,9 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
option(BUILD_SHARED_LIBS "Whether to build shared libraries" ON) option(BUILD_SHARED_LIBS "Whether to build shared libraries" ON)
option(kaldifeat_BUILD_TESTS "Whether to build tests or not" ON) option(kaldifeat_BUILD_TESTS "Whether to build tests or not" OFF)
option(kaldifeat_BUILD_PYMODULE "Whether to build python module or not" ON) option(kaldifeat_BUILD_PYMODULE "Whether to build python module or not" ON)
message(STATUS "BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}") message(STATUS "BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}")
if(BUILD_SHARED_LIBS AND MSVC) if(BUILD_SHARED_LIBS AND MSVC)

View File

@ -14,6 +14,20 @@
**Note**: If you are looking for a version that does not depend on PyTorch, **Note**: If you are looking for a version that does not depend on PyTorch,
please see <https://github.com/csukuangfj/kaldi-native-fbank> please see <https://github.com/csukuangfj/kaldi-native-fbank>
# Installation
Refer to
<https://csukuangfj.github.io/kaldifeat/installation/from_wheels.html>
for installation.
> Never use `pip install kaldifeat`
> Never use `pip install kaldifeat`
> Never use `pip install kaldifeat`
<sub> <sub>
<table> <table>
<tr> <tr>
@ -312,8 +326,4 @@ extraction.
See <https://github.com/k2-fsa/sherpa/blob/master/sherpa/bin/pruned_stateless_emformer_rnnt2/decode.py> See <https://github.com/k2-fsa/sherpa/blob/master/sherpa/bin/pruned_stateless_emformer_rnnt2/decode.py>
# Installation
Refer to
<https://csukuangfj.github.io/kaldifeat>
for installation.

View File

@ -8,19 +8,18 @@ function(download_pybind11)
include(FetchContent) include(FetchContent)
# latest commit as of 2022.10.31 that supports python 3.11 set(pybind11_URL "https://github.com/pybind/pybind11/archive/refs/tags/v2.12.0.tar.gz")
set(pybind11_URL "https://github.com/pybind/pybind11/archive/5bc0943ed96836f46489f53961f6c438d2935357.zip") set(pybind11_URL2 "https://hf-mirror.com/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/pybind11-2.12.0.tar.gz")
set(pybind11_URL2 "https://huggingface.co/csukuangfj/k2-cmake-deps/resolve/main/pybind11-5bc0943ed96836f46489f53961f6c438d2935357.zip") set(pybind11_HASH "SHA256=bf8f242abd1abcd375d516a7067490fb71abd79519a282d22b6e4d19282185a7")
set(pybind11_HASH "SHA256=ff65a1a8c9e6ceec11e7ed9d296f2e22a63e9ff0c4264b3af29c72b4f18f25a0")
# If you don't have access to the Internet, # If you don't have access to the Internet,
# please pre-download pybind11 # please pre-download pybind11
set(possible_file_locations set(possible_file_locations
$ENV{HOME}/Downloads/pybind11-5bc0943ed96836f46489f53961f6c438d2935357.zip $ENV{HOME}/Downloads/pybind11-2.12.0.tar.gz
${PROJECT_SOURCE_DIR}/pybind11-5bc0943ed96836f46489f53961f6c438d2935357.zip ${CMAKE_SOURCE_DIR}/pybind11-2.12.0.tar.gz
${PROJECT_BINARY_DIR}/pybind11-5bc0943ed96836f46489f53961f6c438d2935357.zip ${CMAKE_BINARY_DIR}/pybind11-2.12.0.tar.gz
/tmp/pybind11-5bc0943ed96836f46489f53961f6c438d2935357.zip /tmp/pybind11-2.12.0.tar.gz
/star-fj/fangjun/download/github/pybind11-5bc0943ed96836f46489f53961f6c438d2935357.zip /star-fj/fangjun/download/github/pybind11-2.12.0.tar.gz
) )
foreach(f IN LISTS possible_file_locations) foreach(f IN LISTS possible_file_locations)

View File

@ -9,6 +9,11 @@ You can find pre-compiled wheels at
We give a few examples below to show you how to install `kaldifeat`_ from We give a few examples below to show you how to install `kaldifeat`_ from
pre-compiled wheels. pre-compiled wheels.
.. hint::
The following lists only some examples. We suggest that you always select the
latest version of ``kaldifeat``.
Linux (CPU) Linux (CPU)
----------- -----------
@ -16,22 +21,29 @@ Suppose you want to install the following wheel:
.. code-block:: bash .. code-block:: bash
https://huggingface.co/csukuangfj/kaldifeat/resolve/main/ubuntu-cpu/kaldifeat-1.25.3.dev20231221+cpu.torch2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl https://huggingface.co/csukuangfj/kaldifeat/resolve/main/ubuntu-cpu/kaldifeat-1.25.4.dev20240725+cpu.torch2.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
you can use one of the following methods: you can use one of the following methods:
.. code-block:: bash .. code-block:: bash
# method 1 # method 1
pip install torch==2.1.2+cpu -f https://download.pytorch.org/whl/torch_stable.html pip install torch==2.4.0+cpu -f https://download.pytorch.org/whl/torch/
pip install kaldifeat==1.25.3.dev20231221+cpu.torch2.1.2 -f https://csukuangfj.github.io/kaldifeat/cpu.html pip install kaldifeat==1.25.4.dev20240725+cpu.torch2.4.0 -f https://csukuangfj.github.io/kaldifeat/cpu.html
# For users from China
# 中国国内用户,如果访问不了 huggingface, 请使用
# pip install kaldifeat==1.25.4.dev20240725+cpu.torch2.4.0 -f https://csukuangfj.github.io/kaldifeat/cpu-cn.html
# method 2 # method 2
pip install torch==2.1.2+cpu -f https://download.pytorch.org/whl/torch_stable.html pip install torch==2.4.0+cpu -f https://download.pytorch.org/whl/torch/
wget https://huggingface.co/csukuangfj/kaldifeat/resolve/main/ubuntu-cpu/kaldifeat-1.25.3.dev20231221+cpu.torch2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl wget https://huggingface.co/csukuangfj/kaldifeat/resolve/main/ubuntu-cpu/kaldifeat-1.25.4.dev20240725+cpu.torch2.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pip install ./kaldifeat-1.25.3.dev20231221+cpu.torch2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
# For users from China
# 中国国内用户,如果访问不了 huggingface, 请使用
# wget https://hf-mirror.com/csukuangfj/kaldifeat/resolve/main/ubuntu-cpu/kaldifeat-1.25.4.dev20240725+cpu.torch2.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pip install ./kaldifeat-1.25.4.dev20240725+cpu.torch2.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Windows (CPU) Windows (CPU)
-------------- --------------
@ -40,20 +52,29 @@ Suppose you want to install the following wheel:
.. code-block:: bash .. code-block:: bash
https://huggingface.co/csukuangfj/kaldifeat/resolve/main/windows-cpu/kaldifeat-1.25.3.dev20231221+cpu.torch2.1.2-cp311-cp311-win_amd64.whl https://huggingface.co/csukuangfj/kaldifeat/resolve/main/windows-cpu/kaldifeat-1.25.4.dev20240725+cpu.torch2.4.0-cp312-cp312-win_amd64.whl
you can use one of the following methods: you can use one of the following methods:
.. code-block:: bash .. code-block:: bash
# method 1 # method 1
pip install torch==2.1.2+cpu -f https://download.pytorch.org/whl/torch_stable.html pip install torch==2.4.0+cpu -f https://download.pytorch.org/whl/torch/
pip install kaldifeat==1.25.3.dev20231221+cpu.torch2.1.2 -f https://csukuangfj.github.io/kaldifeat/cpu.html pip install kaldifeat==1.25.4.dev20240725+cpu.torch2.4.0 -f https://csukuangfj.github.io/kaldifeat/cpu.html
# For users from China
# 中国国内用户,如果访问不了 huggingface, 请使用
# pip install kaldifeat==1.25.4.dev20240725+cpu.torch2.4.0 -f https://csukuangfj.github.io/kaldifeat/cpu-cn.html
# method 2 # method 2
pip install torch==2.1.2+cpu -f https://download.pytorch.org/whl/torch_stable.html pip install torch==2.4.0+cpu -f https://download.pytorch.org/whl/torch/
wget https://huggingface.co/csukuangfj/kaldifeat/resolve/main/windows-cpu/kaldifeat-1.25.3.dev20231221+cpu.torch2.1.2-cp311-cp311-win_amd64.whl wget https://huggingface.co/csukuangfj/kaldifeat/resolve/main/windows-cpu/kaldifeat-1.25.4.dev20240725+cpu.torch2.4.0-cp312-cp312-win_amd64.whl
pip install ./kaldifeat-1.25.3.dev20231221+cpu.torch2.1.2-cp311-cp311-win_amd64.whl
# For users from China
# 中国国内用户,如果访问不了 huggingface, 请使用
# wget https://hf-mirror.com/csukuangfj/kaldifeat/resolve/main/windows-cpu/kaldifeat-1.25.4.dev20240725+cpu.torch2.4.0-cp312-cp312-win_amd64.whl
pip install ./kaldifeat-1.25.4.dev20240725+cpu.torch2.4.0-cp312-cp312-win_amd64.whl
macOS (CPU) macOS (CPU)
----------- -----------
@ -62,20 +83,29 @@ Suppose you want to install the following wheel:
.. code-block:: bash .. code-block:: bash
https://huggingface.co/csukuangfj/kaldifeat/resolve/main/macos/kaldifeat-1.25.3.dev20231221+cpu.torch2.1.2-cp311-cp311-macosx_10_9_x86_64.whl https://huggingface.co/csukuangfj/kaldifeat/resolve/main/macos/kaldifeat-1.25.4.dev20240725+cpu.torch2.4.0-cp311-cp311-macosx_11_0_arm64.whl
you can use one of the following methods: you can use one of the following methods:
.. code-block:: bash .. code-block:: bash
# method 1 # method 1
pip install torch==2.1.2 pip install torch==2.4.0
pip install kaldifeat==1.25.3.dev20231221+cpu.torch2.1.2 -f https://csukuangfj.github.io/kaldifeat/cpu.html pip install kaldifeat==1.25.4.dev20240725+cpu.torch2.4.0 -f https://csukuangfj.github.io/kaldifeat/cpu.html
# For users from China
# 中国国内用户,如果访问不了 huggingface, 请使用
# pip install kaldifeat==1.25.4.dev20240725+cpu.torch2.4.0 -f https://csukuangfj.github.io/kaldifeat/cpu-cn.html
# method 2 # method 2
pip install torch==2.1.2 -f https://download.pytorch.org/whl/torch_stable.html pip install torch==2.4.0 -f https://download.pytorch.org/whl/torch/
wget https://huggingface.co/csukuangfj/kaldifeat/resolve/main/macos/kaldifeat-1.25.3.dev20231221+cpu.torch2.1.2-cp311-cp311-macosx_10_9_x86_64.whl wget https://huggingface.co/csukuangfj/kaldifeat/resolve/main/macos/kaldifeat-1.25.4.dev20240725+cpu.torch2.4.0-cp311-cp311-macosx_11_0_arm64.whl
pip install ./kaldifeat-1.25.3.dev20231221+cpu.torch2.1.2-cp311-cp311-macosx_10_9_x86_64.whl
# For users from China
# 中国国内用户,如果访问不了 huggingface, 请使用
# wget https://hf-mirror.com/csukuangfj/kaldifeat/resolve/main/macos/kaldifeat-1.25.4.dev20240725+cpu.torch2.4.0-cp311-cp311-macosx_11_0_arm64.whl
pip install ./kaldifeat-1.25.4.dev20240725+cpu.torch2.4.0-cp311-cp311-macosx_11_0_arm64.whl
Linux (CUDA) Linux (CUDA)
------------ ------------
@ -84,17 +114,26 @@ Suppose you want to install the following wheel:
.. code-block:: bash .. code-block:: bash
https://huggingface.co/csukuangfj/kaldifeat/resolve/main/ubuntu-cuda/kaldifeat-1.25.3.dev20231221+cuda12.1.torch2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl https://huggingface.co/csukuangfj/kaldifeat/resolve/main/ubuntu-cuda/kaldifeat-1.25.4.dev20240725+cuda12.4.torch2.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
you can use one of the following methods: you can use one of the following methods:
.. code-block:: bash .. code-block:: bash
# method 1 # method 1
pip install torch==2.1.2+cu121 -f https://download.pytorch.org/whl/torch_stable.html pip install torch==2.4.0+cu124 -f https://download.pytorch.org/whl/torch/
pip install kaldifeat==1.25.3.dev20231221+cuda12.1.torch2.1.2 -f https://csukuangfj.github.io/kaldifeat/cuda.html pip install kaldifeat==1.25.4.dev20240725+cuda12.4.torch2.4.0 -f https://csukuangfj.github.io/kaldifeat/cuda.html
# For users from China
# 中国国内用户,如果访问不了 huggingface, 请使用
# pip install kaldifeat==1.25.4.dev20240725+cuda12.4.torch2.4.0 -f https://csukuangfj.github.io/kaldifeat/cuda-cn.html
# method 2 # method 2
pip install torch==2.1.2+cu121 -f https://download.pytorch.org/whl/torch_stable.html pip install torch==2.4.0+cu124 -f https://download.pytorch.org/whl/torch/
wget https://huggingface.co/csukuangfj/kaldifeat/resolve/main/ubuntu-cuda/kaldifeat-1.25.3.dev20231221+cuda12.1.torch2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl wget https://huggingface.co/csukuangfj/kaldifeat/resolve/main/ubuntu-cuda/kaldifeat-1.25.4.dev20240725+cuda12.4.torch2.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pip install ./kaldifeat-1.25.3.dev20231221+cuda12.1.torch2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
# For users from China
# 中国国内用户,如果访问不了 huggingface, 请使用
# wget https://hf-mirror.com/csukuangfj/kaldifeat/resolve/main/ubuntu-cuda/kaldifeat-1.25.4.dev20240725+cuda12.4.torch2.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pip install ./kaldifeat-1.25.4.dev20240725+cuda12.4.torch2.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

View File

@ -138,7 +138,7 @@ MelBanks::MelBanks(const MelBanksOptions &opts,
<< " and vtln-high " << vtln_high << ", versus " << " and vtln-high " << vtln_high << ", versus "
<< "low-freq " << low_freq << " and high-freq " << high_freq; << "low-freq " << low_freq << " and high-freq " << high_freq;
// we will transpose bins_mat_ at the end of this funciton // we will transpose bins_mat_ at the end of this function
bins_mat_ = torch::zeros({num_bins, num_fft_bins}, torch::kFloat); bins_mat_ = torch::zeros({num_bins, num_fft_bins}, torch::kFloat);
int32_t stride = bins_mat_.strides()[0]; int32_t stride = bins_mat_.strides()[0];
@ -179,13 +179,15 @@ MelBanks::MelBanks(const MelBanksOptions &opts,
last_index = i; last_index = i;
} }
} }
KALDIFEAT_ASSERT(first_index != -1 && last_index >= first_index &&
"You may have set num_mel_bins too large."); // Note: It is possible that first_index == last_index == -1 at this line.
// Replicate a bug in HTK, for testing purposes. // Replicate a bug in HTK, for testing purposes.
if (opts.htk_mode && bin == 0 && mel_low_freq != 0.0f) if (opts.htk_mode && bin == 0 && mel_low_freq != 0.0f &&
first_index != -1) {
this_bin[first_index] = 0.0f; this_bin[first_index] = 0.0f;
} }
}
if (debug_) KALDIFEAT_LOG << bins_mat_; if (debug_) KALDIFEAT_LOG << bins_mat_;

View File

@ -29,10 +29,10 @@ endif()
target_link_libraries(_kaldifeat PRIVATE kaldifeat_core) target_link_libraries(_kaldifeat PRIVATE kaldifeat_core)
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
target_link_libraries(_kaldifeat PUBLIC ${TORCH_DIR}/lib/libtorch_python.so) target_link_libraries(_kaldifeat PUBLIC ${TORCH_DIR}/lib/libtorch_python.so)
target_link_libraries(_kaldifeat PUBLIC ${PYTHON_LIBRARY}) # target_link_libraries(_kaldifeat PUBLIC ${PYTHON_LIBRARY})
elseif(WIN32) elseif(WIN32)
target_link_libraries(_kaldifeat PUBLIC ${TORCH_DIR}/lib/torch_python.lib) target_link_libraries(_kaldifeat PUBLIC ${TORCH_DIR}/lib/torch_python.lib)
target_link_libraries(_kaldifeat PUBLIC ${PYTHON_LIBRARIES}) # target_link_libraries(_kaldifeat PUBLIC ${PYTHON_LIBRARIES})
endif() endif()
install(TARGETS _kaldifeat install(TARGETS _kaldifeat

View File

@ -1,6 +1,6 @@
package: package:
name: kaldifeat name: kaldifeat
version: "1.25.4" version: "1.25.5"
source: source:
path: "{{ environ.get('KALDIFEAT_ROOT_DIR') }}" path: "{{ environ.get('KALDIFEAT_ROOT_DIR') }}"

View File

@ -1,6 +1,6 @@
package: package:
name: kaldifeat name: kaldifeat
version: "1.25.4" version: "1.25.5"
source: source:
path: "{{ environ.get('KALDIFEAT_ROOT_DIR') }}" path: "{{ environ.get('KALDIFEAT_ROOT_DIR') }}"

View File

@ -0,0 +1,78 @@
#!/usr/bin/env bash
#
set -ex
if [ -z $PYTHON_VERSION ]; then
echo "Please set the environment variable PYTHON_VERSION"
echo "Example: export PYTHON_VERSION=3.8"
# Valid values: 3.8, 3.9, 3.10, 3.11
exit 1
fi
if [ -z $TORCH_VERSION ]; then
echo "Please set the environment variable TORCH_VERSION"
echo "Example: export TORCH_VERSION=1.10.0"
exit 1
fi
export PATH=$PYTHON_INSTALL_DIR/bin:$PATH
export LD_LIBRARY_PATH=$PYTHON_INSTALL_DIR/lib:$LD_LIBRARY_PATH
ls -lh $PYTHON_INSTALL_DIR/lib/
python3 --version
which python3
python3 -m pip install scikit-build
python3 -m pip install -U pip cmake
python3 -m pip install wheel twine typing_extensions
python3 -m pip install bs4 requests tqdm auditwheel
echo "Installing torch"
python3 -m pip install -qq torch==$TORCH_VERSION || \
python3 -m pip install -qq torch==$TORCH_VERSION -f https://download.pytorch.org/whl/torch_stable.html || \
python3 -m pip install -qq torch==$TORCH_VERSION -f https://download.pytorch.org/whl/torch/
rm -rf ~/.cache/pip
yum clean all
cd /var/www
export CMAKE_CUDA_COMPILER_LAUNCHER=
export KALDIFEAT_CMAKE_ARGS=" -DPYTHON_EXECUTABLE=$PYTHON_INSTALL_DIR/bin/python3 "
export KALDIFEAT_MAKE_ARGS=" -j "
nvcc --version || true
rm -rf /usr/local/cuda*
nvcc --version || true
if [[ x"$IS_2_28" == x"1" ]]; then
plat=manylinux_2_28_aarch64
else
plat=manylinux_2_17_aarch64
fi
python3 setup.py bdist_wheel
auditwheel --verbose repair \
--exclude libc10.so \
--exclude libc10_cuda.so \
--exclude libcuda.so.1 \
--exclude libcudart.so.${CUDA_VERSION} \
--exclude libnvToolsExt.so.1 \
--exclude libnvrtc.so.${CUDA_VERSION} \
--exclude libtorch.so \
--exclude libtorch_cpu.so \
--exclude libtorch_cuda.so \
--exclude libtorch_python.so \
\
--exclude libcudnn.so.8 \
--exclude libcublas.so.11 \
--exclude libcublasLt.so.11 \
--exclude libcudart.so.11.0 \
--exclude libnvrtc.so.11.2 \
--exclude libtorch_cuda_cu.so \
--exclude libtorch_cuda_cpp.so \
--plat $plat \
dist/*.whl
ls -lh /var/www

View File

@ -15,49 +15,21 @@ if [ -z $TORCH_VERSION ]; then
exit 1 exit 1
fi fi
yum -y install openssl-devel bzip2-devel libffi-devel xz-devel wget redhat-lsb-core
echo "Installing ${PYTHON_VERSION}.3"
curl -O https://www.python.org/ftp/python/${PYTHON_VERSION}.3/Python-${PYTHON_VERSION}.3.tgz
tar xf Python-${PYTHON_VERSION}.3.tgz
pushd Python-${PYTHON_VERSION}.3
PYTHON_INSTALL_DIR=$PWD/py-${PYTHON_VERSION}
if [[ $PYTHON_VERSION =~ 3.1. ]]; then
yum install -y openssl11-devel
sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure
fi
./configure --enable-shared --prefix=$PYTHON_INSTALL_DIR >/dev/null 2>&1
make install >/dev/null 2>&1
popd
export PATH=$PYTHON_INSTALL_DIR/bin:$PATH export PATH=$PYTHON_INSTALL_DIR/bin:$PATH
export LD_LIBRARY_PATH=$PYTHON_INSTALL_DIR/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=$PYTHON_INSTALL_DIR/lib:$LD_LIBRARY_PATH
ls -lh $PYTHON_INSTALL_DIR/lib/ ls -lh $PYTHON_INSTALL_DIR/lib/
nvcc --version || true
rm -rf /usr/local/cuda*
nvcc --version || true
python3 --version python3 --version
which python3 which python3
if [[ $PYTHON_VERSION != 3.6 ]]; then
curl -O https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
fi
python3 -m pip install scikit-build python3 -m pip install scikit-build
python3 -m pip install -U pip cmake python3 -m pip install -U pip cmake
python3 -m pip install wheel twine typing_extensions python3 -m pip install wheel twine typing_extensions
python3 -m pip install bs4 requests tqdm auditwheel python3 -m pip install bs4 requests tqdm auditwheel
echo "Installing torch" echo "Installing torch"
python3 -m pip install -qq torch==$TORCH_VERSION+cpu -f https://download.pytorch.org/whl/torch_stable.html python3 -m pip install -qq torch==$TORCH_VERSION+cpu -f https://download.pytorch.org/whl/torch_stable.html || \
python3 -m pip install -qq torch==$TORCH_VERSION+cpu -f https://download.pytorch.org/whl/torch/
rm -rf ~/.cache/pip rm -rf ~/.cache/pip
yum clean all yum clean all
@ -68,8 +40,16 @@ export CMAKE_CUDA_COMPILER_LAUNCHER=
export KALDIFEAT_CMAKE_ARGS=" -DPYTHON_EXECUTABLE=$PYTHON_INSTALL_DIR/bin/python3 " export KALDIFEAT_CMAKE_ARGS=" -DPYTHON_EXECUTABLE=$PYTHON_INSTALL_DIR/bin/python3 "
export KALDIFEAT_MAKE_ARGS=" -j " export KALDIFEAT_MAKE_ARGS=" -j "
nvcc --version || true
rm -rf /usr/local/cuda*
nvcc --version || true
python3 setup.py bdist_wheel python3 setup.py bdist_wheel
if [[ x"$IS_2_28" == x"1" ]]; then
plat=manylinux_2_28_x86_64
else
plat=manylinux_2_17_x86_64
fi
auditwheel --verbose repair \ auditwheel --verbose repair \
--exclude libc10.so \ --exclude libc10.so \
@ -90,8 +70,7 @@ auditwheel --verbose repair \
--exclude libnvrtc.so.11.2 \ --exclude libnvrtc.so.11.2 \
--exclude libtorch_cuda_cu.so \ --exclude libtorch_cuda_cu.so \
--exclude libtorch_cuda_cpp.so \ --exclude libtorch_cuda_cpp.so \
--plat manylinux_2_17_x86_64 \ --plat $plat \
-w /var/www/wheelhouse \
dist/*.whl dist/*.whl
ls -lh /var/www ls -lh /var/www

View File

@ -22,44 +22,12 @@ if [ -z $CUDA_VERSION ]; then
exit 1 exit 1
fi fi
if [[ $TORCH_VERSION =~ 2.2.* && $CUDA_VERSION =~ 12.* ]]; then
yum -y install openssl-devel bzip2-devel libffi-devel xz-devel wget redhat-lsb-core # see https://github.com/pytorch/pytorch/issues/113948
export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0"
echo "Installing ${PYTHON_VERSION}.3"
curl -O https://www.python.org/ftp/python/${PYTHON_VERSION}.3/Python-${PYTHON_VERSION}.3.tgz
tar xf Python-${PYTHON_VERSION}.3.tgz
pushd Python-${PYTHON_VERSION}.3
PYTHON_INSTALL_DIR=$PWD/py-${PYTHON_VERSION}
if [[ $PYTHON_VERSION =~ 3.1. ]]; then
yum install -y openssl11-devel
sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure
fi fi
./configure --enable-shared --prefix=$PYTHON_INSTALL_DIR >/dev/null 2>&1 # python3 -m pip install scikit-build
make install >/dev/null 2>&1
popd
echo "pwd: $PWD"
# rm -rf Python-${PYTHON_VERSION}.3
export PATH=$PYTHON_INSTALL_DIR/bin:$PATH
export LD_LIBRARY_PATH=$PYTHON_INSTALL_DIR/lib:$LD_LIBRARY_PATH
ls -lh $PYTHON_INSTALL_DIR
ls -lh $PYTHON_INSTALL_DIR/lib/
python3 --version
which python3
if [[ $PYTHON_VERSION != 3.6 ]]; then
curl -O https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
fi
python3 -m pip install scikit-build
python3 -m pip install -U pip cmake python3 -m pip install -U pip cmake
python3 -m pip install wheel twine typing_extensions python3 -m pip install wheel twine typing_extensions
python3 -m pip install bs4 requests tqdm auditwheel python3 -m pip install bs4 requests tqdm auditwheel
@ -67,6 +35,56 @@ python3 -m pip install bs4 requests tqdm auditwheel
echo "Installing torch" echo "Installing torch"
./install_torch.sh ./install_torch.sh
python3 -c "import torch; print(torch.__file__)"
# -- Autodetected CUDA architecture(s): 5.0;8.0;8.6;8.9;9.0;9.0a
# CMake Error at /Python-3.8.2/py-3.8/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake:227 (message):
# Unknown CUDA Architecture Name 9.0a in CUDA_SELECT_NVCC_ARCH_FLAGS
# Call Stack (most recent call first):
# /Python-3.8.2/py-3.8/lib/python3.8/site-packages/torch/share/cmake/Caffe2/public/utils.cmake:401 (cuda_select_nvcc_arch_flags)
# /Python-3.8.2/py-3.8/lib/python3.8/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake:342 (torch_cuda_get_nvcc_gencode_flag)
# /Python-3.8.2/py-3.8/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:87 (include)
# /Python-3.8.2/py-3.8/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
# cmake/torch.cmake:14 (find_package)
# CMakeLists.txt:62 (include)
sed -i.bak /9.0a/d /Python-*/py-3.*/lib/python3.*/site-packages/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake || true
if [[ x"$IS_2_28" != x"1" ]]; then
yum -y install openssl-devel
fi
yum -y install zlib-devel bzip2-devel libffi-devel xz-devel wget redhat-lsb-core
INSTALLED_PYTHON_VERSION=${PYTHON_VERSION}.2
if [[ $PYTHON_VERSION == "3.13" ]]; then
INSTALLED_PYTHON_VERSION=${PYTHON_VERSION}.0
fi
echo "Installing $INSTALLED_PYTHON_VERSION"
curl -O https://www.python.org/ftp/python/$INSTALLED_PYTHON_VERSION/Python-$INSTALLED_PYTHON_VERSION.tgz
tar xf Python-$INSTALLED_PYTHON_VERSION.tgz
pushd Python-$INSTALLED_PYTHON_VERSION
PYTHON_INSTALL_DIR=$PWD/py-${PYTHON_VERSION}
if [[ $PYTHON_VERSION =~ 3.1. && x"$IS_2_28" != x"1" ]]; then
yum install -y openssl11-devel
sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure
fi
./configure --enable-shared --prefix=$PYTHON_INSTALL_DIR >/dev/null
make install >/dev/null
popd
export PATH=$PYTHON_INSTALL_DIR/bin:$PATH
export LD_LIBRARY_PATH=$PYTHON_INSTALL_DIR/lib:$LD_LIBRARY_PATH
ls -lh $PYTHON_INSTALL_DIR/lib/
python3 --version
which python3
rm -rf ~/.cache/pip >/dev/null 2>&1 rm -rf ~/.cache/pip >/dev/null 2>&1
yum clean all >/dev/null 2>&1 yum clean all >/dev/null 2>&1
@ -76,9 +94,20 @@ export CMAKE_CUDA_COMPILER_LAUNCHER=
export KALDIFEAT_CMAKE_ARGS=" -DPYTHON_EXECUTABLE=$PYTHON_INSTALL_DIR/bin/python3 " export KALDIFEAT_CMAKE_ARGS=" -DPYTHON_EXECUTABLE=$PYTHON_INSTALL_DIR/bin/python3 "
export KALDIFEAT_MAKE_ARGS=" -j2 " export KALDIFEAT_MAKE_ARGS=" -j2 "
echo "KALDIFEAT_CMAKE_ARGS: $KALDIFEAT_CMAKE_ARGS"
python3 setup.py bdist_wheel python3 setup.py bdist_wheel
if [[ x"$IS_2_28" == x"1" ]]; then
plat=manylinux_2_28_x86_64
else
plat=manylinux_2_17_x86_64
fi
export PATH=$PYTHON_INSTALL_DIR/bin:$PATH
python3 --version
which python3
auditwheel --verbose repair \ auditwheel --verbose repair \
--exclude libc10.so \ --exclude libc10.so \
--exclude libc10_cuda.so \ --exclude libc10_cuda.so \
@ -91,14 +120,34 @@ auditwheel --verbose repair \
--exclude libtorch_cuda.so \ --exclude libtorch_cuda.so \
--exclude libtorch_python.so \ --exclude libtorch_python.so \
\ \
--exclude libcudnn.so.8 \ --exclude libcublas.so \
--exclude libcublas.so.11 \ --exclude libcublas.so.11 \
--exclude libcublas.so.12 \
--exclude libcublasLt.so \
--exclude libcublasLt.so.11 \ --exclude libcublasLt.so.11 \
--exclude libcublasLt.so.12 \
--exclude libcudart.so.11.0 \ --exclude libcudart.so.11.0 \
--exclude libcudart.so.12 \
--exclude libcudnn.so.8 \
--exclude libcufft.so \
--exclude libcufft.so.11 \
--exclude libcupti.so \
--exclude libcupti.so.12 \
--exclude libcurand.so \
--exclude libcurand.so.10 \
--exclude libcusparse.so \
--exclude libcusparse.so.12 \
--exclude libnccl.so \
--exclude libnccl.so.2 \
--exclude libnvJitLink.so \
--exclude libnvJitLink.so.12 \
--exclude libnvrtc.so \
--exclude libnvrtc.so.11.2 \ --exclude libnvrtc.so.11.2 \
--exclude libtorch_cuda_cu.so \ --exclude libnvrtc.so.12 \
--exclude libshm.so \
--exclude libtorch_cuda_cpp.so \ --exclude libtorch_cuda_cpp.so \
--plat manylinux_2_17_x86_64 \ --exclude libtorch_cuda_cu.so \
--plat $plat \
-w /var/www/wheelhouse \ -w /var/www/wheelhouse \
dist/*.whl dist/*.whl

View File

@ -1,10 +1,31 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Copyright 2022 Xiaomi Corp. (authors: Fangjun Kuang) # Copyright 2022 Xiaomi Corp. (authors: Fangjun Kuang)
"""
See also
https://github.com/pytorch/test-infra/blob/main/.github/workflows/test_build_wheels_linux_with_cuda.yml
https://github.com/pytorch/test-infra/blob/main/.github/workflows/test_build_wheels_linux_without_cuda.yml
https://github.com/pytorch/test-infra/actions/workflows/test_build_wheels_linux_with_cuda.yml
https://github.com/pytorch/test-infra/blob/main/tools/scripts/generate_binary_build_matrix.py
"""
import argparse import argparse
import json import json
def version_ge(a, b):
a_major, a_minor = list(map(int, a.split(".")))[:2]
b_major, b_minor = list(map(int, b.split(".")))[:2]
if a_major > b_major:
return True
if a_major == b_major and a_minor >= b_minor:
return True
return False
def get_args(): def get_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument(
@ -28,6 +49,13 @@ def get_args():
help="True for macOS", help="True for macOS",
) )
parser.add_argument(
"--for-arm64",
action="store_true",
default=False,
help="True for arm64",
)
parser.add_argument( parser.add_argument(
"--test-only-latest-torch", "--test-only-latest-torch",
action="store_true", action="store_true",
@ -38,7 +66,9 @@ def get_args():
return parser.parse_args() return parser.parse_args()
def generate_build_matrix(enable_cuda, for_windows, for_macos, test_only_latest_torch): def generate_build_matrix(
enable_cuda, for_windows, for_macos, test_only_latest_torch, for_arm64
):
matrix = { matrix = {
# 1.5.x is removed because there are compilation errors. # 1.5.x is removed because there are compilation errors.
# See # See
@ -53,77 +83,91 @@ def generate_build_matrix(enable_cuda, for_windows, for_macos, test_only_latest_
# "python-version": ["3.6", "3.7", "3.8"], # "python-version": ["3.6", "3.7", "3.8"],
# "cuda": ["10.1", "10.2"], # "cuda": ["10.1", "10.2"],
# }, # },
"1.6.0": { # "1.6.0": {
"python-version": ["3.6", "3.7", "3.8"], # "python-version": ["3.6", "3.7", "3.8"],
"cuda": ["10.1", "10.2"] if not for_windows else ["10.1.243", "10.2.89"], # "cuda": ["10.1", "10.2"] if not for_windows else ["10.1.243", "10.2.89"],
}, # },
"1.7.0": { # "1.7.0": {
"python-version": ["3.6", "3.7", "3.8"], # "python-version": ["3.6", "3.7", "3.8"],
"cuda": ["10.1", "10.2", "11.0"] # "cuda": (
if not for_windows # ["10.1", "10.2", "11.0"]
else ["10.1.243", "10.2.89", "11.0.3"], # if not for_windows
}, # else ["10.1.243", "10.2.89", "11.0.3"]
"1.7.1": { # ),
"python-version": ["3.6", "3.7", "3.8", "3.9"], # },
"cuda": ["10.1", "10.2", "11.0"] # "1.7.1": {
if not for_windows # "python-version": ["3.6", "3.7", "3.8", "3.9"],
else ["10.1.243", "10.2.89", "11.0.3"], # "cuda": (
}, # ["10.1", "10.2", "11.0"]
"1.8.0": { # if not for_windows
"python-version": ["3.6", "3.7", "3.8", "3.9"], # else ["10.1.243", "10.2.89", "11.0.3"]
"cuda": ["10.1", "10.2", "11.1"] # ),
if not for_windows # },
else ["10.1.243", "10.2.89", "11.1.1"], # "1.8.0": {
}, # "python-version": ["3.6", "3.7", "3.8", "3.9"],
"1.8.1": { # "cuda": (
"python-version": ["3.6", "3.7", "3.8", "3.9"], # ["10.1", "10.2", "11.1"]
"cuda": ["10.1", "10.2", "11.1"] # if not for_windows
if not for_windows # else ["10.1.243", "10.2.89", "11.1.1"]
else ["10.1.243", "10.2.89", "11.1.1"], # ),
}, # },
"1.9.0": { # "1.8.1": {
"python-version": ["3.6", "3.7", "3.8", "3.9"], # "python-version": ["3.6", "3.7", "3.8", "3.9"],
"cuda": ["10.2", "11.1"] if not for_windows else ["10.2.89", "11.1.1"], # "cuda": (
}, # ["10.1", "10.2", "11.1"]
"1.9.1": { # if not for_windows
"python-version": ["3.6", "3.7", "3.8", "3.9"], # else ["10.1.243", "10.2.89", "11.1.1"]
"cuda": ["10.2", "11.1"] if not for_windows else ["10.2.89", "11.1.1"], # ),
}, # },
# "1.9.0": {
# "python-version": ["3.6", "3.7", "3.8", "3.9"],
# "cuda": ["10.2", "11.1"] if not for_windows else ["10.2.89", "11.1.1"],
# },
# "1.9.1": {
# "python-version": ["3.6", "3.7", "3.8", "3.9"],
# "cuda": ["10.2", "11.1"] if not for_windows else ["10.2.89", "11.1.1"],
# },
"1.10.0": { "1.10.0": {
"python-version": ["3.6", "3.7", "3.8", "3.9"], "python-version": ["3.6", "3.7", "3.8", "3.9"],
"cuda": ["10.2", "11.1", "11.3"] "cuda": (
["10.2", "11.1", "11.3"]
if not for_windows if not for_windows
else ["10.2.89", "11.1.1", "11.3.1"], else ["10.2.89", "11.1.1", "11.3.1"]
),
}, },
"1.10.1": { "1.10.1": {
"python-version": ["3.6", "3.7", "3.8", "3.9"], "python-version": ["3.6", "3.7", "3.8", "3.9"],
"cuda": ["10.2", "11.1", "11.3"] "cuda": (
["10.2", "11.1", "11.3"]
if not for_windows if not for_windows
else ["10.2.89", "11.1.1", "11.3.1"], else ["10.2.89", "11.1.1", "11.3.1"]
),
}, },
"1.10.2": { "1.10.2": {
"python-version": ["3.6", "3.7", "3.8", "3.9"], "python-version": ["3.6", "3.7", "3.8", "3.9"],
"cuda": ["10.2", "11.1", "11.3"] "cuda": (
["10.2", "11.1", "11.3"]
if not for_windows if not for_windows
else ["10.2.89", "11.1.1", "11.3.1"], else ["10.2.89", "11.1.1", "11.3.1"]
),
}, },
"1.11.0": { "1.11.0": {
"python-version": ["3.7", "3.8", "3.9", "3.10"], "python-version": ["3.7", "3.8", "3.9", "3.10"],
"cuda": ["10.2", "11.3", "11.5"] "cuda": (
if not for_windows ["10.2", "11.3", "11.5"] if not for_windows else ["11.3.1", "11.5.2"]
else ["11.3.1", "11.5.2"], ),
}, },
"1.12.0": { "1.12.0": {
"python-version": ["3.7", "3.8", "3.9", "3.10"], "python-version": ["3.7", "3.8", "3.9", "3.10"],
"cuda": ["10.2", "11.3", "11.6"] "cuda": (
if not for_windows ["10.2", "11.3", "11.6"] if not for_windows else ["11.3.1", "11.6.2"]
else ["11.3.1", "11.6.2"], ),
}, },
"1.12.1": { "1.12.1": {
"python-version": ["3.7", "3.8", "3.9", "3.10"], "python-version": ["3.7", "3.8", "3.9", "3.10"],
"cuda": ["10.2", "11.3", "11.6"] "cuda": (
if not for_windows ["10.2", "11.3", "11.6"] if not for_windows else ["11.3.1", "11.6.2"]
else ["11.3.1", "11.6.2"], ),
}, },
"1.13.0": { "1.13.0": {
"python-version": ["3.7", "3.8", "3.9", "3.10", "3.11"], "python-version": ["3.7", "3.8", "3.9", "3.10", "3.11"],
@ -131,47 +175,171 @@ def generate_build_matrix(enable_cuda, for_windows, for_macos, test_only_latest_
}, },
"1.13.1": { "1.13.1": {
"python-version": ["3.7", "3.8", "3.9", "3.10", "3.11"], "python-version": ["3.7", "3.8", "3.9", "3.10", "3.11"],
"cuda": ["11.6", "11.7"] # default 11.7 "cuda": (
["11.6", "11.7"] # default 11.7
if not for_windows if not for_windows
else ["11.6.2", "11.7.1"], else ["11.6.2", "11.7.1"]
),
}, },
"2.0.0": { "2.0.0": {
"python-version": ["3.8", "3.9", "3.10", "3.11"], "python-version": ["3.8", "3.9", "3.10", "3.11"],
"cuda": ["11.7", "11.8"] # default 11.7 "cuda": (
["11.7", "11.8"] # default 11.7
if not for_windows if not for_windows
else ["11.7.1", "11.8.0"], else ["11.7.1", "11.8.0"]
),
}, },
"2.0.1": { "2.0.1": {
"python-version": ["3.8", "3.9", "3.10", "3.11"], "python-version": ["3.8", "3.9", "3.10", "3.11"],
"cuda": ["11.7", "11.8"] # default 11.7 "cuda": (
["11.7", "11.8"] # default 11.7
if not for_windows if not for_windows
else ["11.7.1", "11.8.0"], else ["11.7.1", "11.8.0"]
),
}, },
"2.1.0": { "2.1.0": {
"python-version": ["3.8", "3.9", "3.10", "3.11"], "python-version": ["3.8", "3.9", "3.10", "3.11"],
"cuda": ["11.8", "12.1"] # default 12.1 "cuda": (
["11.8", "12.1"] # default 12.1
if not for_windows if not for_windows
else ["11.8.0", "12.1.0"], else ["11.8.0", "12.1.0"]
),
}, },
"2.1.1": { "2.1.1": {
"python-version": ["3.8", "3.9", "3.10", "3.11"], "python-version": ["3.8", "3.9", "3.10", "3.11"],
"cuda": ["11.8", "12.1"] # default 12.1 "cuda": (
["11.8", "12.1"] # default 12.1
if not for_windows if not for_windows
else ["11.8.0", "12.1.0"], else ["11.8.0", "12.1.0"]
),
}, },
"2.1.2": { "2.1.2": {
"python-version": ["3.8", "3.9", "3.10", "3.11"], "python-version": ["3.8", "3.9", "3.10", "3.11"],
"cuda": ["11.8", "12.1"] # default 12.1 "cuda": (
["11.8", "12.1"] # default 12.1
if not for_windows if not for_windows
else ["11.8.0", "12.1.0"], else ["11.8.0", "12.1.0"]
),
},
"2.2.0": {
"python-version": ["3.8", "3.9", "3.10", "3.11", "3.12"],
"cuda": (
["11.8", "12.1"] # default 12.1
if not for_windows
else ["11.8.0", "12.1.0"]
),
},
"2.2.1": {
"python-version": ["3.8", "3.9", "3.10", "3.11", "3.12"],
"cuda": (
["11.8", "12.1"] # default 12.1
if not for_windows
else ["11.8.0", "12.1.0"]
),
},
"2.2.2": {
"python-version": ["3.8", "3.9", "3.10", "3.11", "3.12"],
"cuda": (
["11.8", "12.1"] # default 12.1
if not for_windows
else ["11.8.0", "12.1.0"]
),
},
"2.3.0": {
"python-version": ["3.8", "3.9", "3.10", "3.11", "3.12"],
"cuda": (
["11.8", "12.1"] # default 12.1
if not for_windows
else ["11.8.0", "12.1.0"]
),
},
"2.3.1": {
"python-version": ["3.8", "3.9", "3.10", "3.11", "3.12"],
"cuda": (
["11.8", "12.1"] # default 12.1
if not for_windows
else ["11.8.0", "12.1.0"]
),
},
"2.4.0": {
"python-version": ["3.8", "3.9", "3.10", "3.11", "3.12"],
"cuda": (
["11.8", "12.1", "12.4"] # default 12.1
if not for_windows
else ["11.8.0", "12.1.0", "12.4.0"]
),
},
"2.4.1": {
"python-version": ["3.8", "3.9", "3.10", "3.11", "3.12"],
"cuda": (
["11.8", "12.1", "12.4"] # default 12.1
if not for_windows
else ["11.8.0", "12.1.0", "12.4.0"]
),
},
"2.5.0": {
# Only Linux supports python 3.13
"python-version": ["3.9", "3.10", "3.11", "3.12", "3.13"],
"cuda": (
["11.8", "12.1", "12.4"] # default 12.4
if not for_windows
else ["11.8.0", "12.1.0", "12.4.0"]
),
},
"2.5.1": {
# Only Linux supports python 3.13
"python-version": ["3.9", "3.10", "3.11", "3.12", "3.13"],
"cuda": (
["11.8", "12.1", "12.4"] # default 12.4
if not for_windows
else ["11.8.0", "12.1.0", "12.4.0"]
),
},
"2.6.0": {
"python-version": ["3.9", "3.10", "3.11", "3.12", "3.13"],
"cuda": (
["11.8", "12.4", "12.6"] # default 12.4
if not for_windows
else ["11.8.0", "12.4.0", "12.6.0"]
),
},
"2.7.0": {
"python-version": ["3.9", "3.10", "3.11", "3.12", "3.13"],
"cuda": (
["11.8", "12.6", "12.8"]
if not for_windows
else ["11.8.0", "12.6.2", "12.8.1"]
),
},
"2.7.1": {
"python-version": ["3.9", "3.10", "3.11", "3.12", "3.13"],
"cuda": (
["11.8", "12.6", "12.8"] # default 12.6
if not for_windows
else ["11.8.0", "12.6.2", "12.8.1"]
),
},
"2.8.0": {
"python-version": ["3.9", "3.10", "3.11", "3.12", "3.13"],
"cuda": (
["12.6", "12.8", "12.9"] # default 12.8
if not for_windows
else ["12.6.2", "12.8.1", "12.9.1"]
),
}, },
# https://github.com/Jimver/cuda-toolkit/blob/master/src/links/windows-links.ts # https://github.com/Jimver/cuda-toolkit/blob/master/src/links/windows-links.ts
} }
if test_only_latest_torch: if test_only_latest_torch:
latest = "2.1.2" latest = "2.8.0"
matrix = {latest: matrix[latest]} matrix = {latest: matrix[latest]}
if for_windows or for_macos: if for_windows or for_macos:
if "2.5.1" in matrix:
matrix["2.5.1"]["python-version"].remove("3.13")
if "2.5.0" in matrix:
matrix["2.5.0"]["python-version"].remove("3.13")
if "1.13.0" in matrix: if "1.13.0" in matrix:
matrix["1.13.0"]["python-version"].remove("3.11") matrix["1.13.0"]["python-version"].remove("3.11")
@ -179,9 +347,18 @@ def generate_build_matrix(enable_cuda, for_windows, for_macos, test_only_latest_
matrix["1.13.1"]["python-version"].remove("3.11") matrix["1.13.1"]["python-version"].remove("3.11")
excluded_python_versions = ["3.6"] excluded_python_versions = ["3.6"]
enabled_torch_versions = ["1.10.0"]
enabled_torch_versions += ["1.13.0", "1.13.1"]
min_torch_version = "2.0.0"
ans = [] ans = []
for torch, python_cuda in matrix.items(): for torch, python_cuda in matrix.items():
if enabled_torch_versions and torch not in enabled_torch_versions:
if not version_ge(torch, min_torch_version):
continue
python_versions = python_cuda["python-version"] python_versions = python_cuda["python-version"]
cuda_versions = python_cuda["cuda"] cuda_versions = python_cuda["cuda"]
if enable_cuda: if enable_cuda:
@ -192,12 +369,30 @@ def generate_build_matrix(enable_cuda, for_windows, for_macos, test_only_latest_
if c in ["10.1", "11.0"]: if c in ["10.1", "11.0"]:
# no docker image for cuda 10.1 and 11.0 # no docker image for cuda 10.1 and 11.0
continue continue
if version_ge(torch, "2.7.0") or (
version_ge(torch, "2.6.0") and c == "12.6"
):
# case 1: torch >= 2.7
# case 2: torch == 2.6.0 && cuda == 12.6
ans.append(
{
"torch": torch,
"python-version": p,
"cuda": c,
"image": f"pytorch/manylinux2_28-builder:cuda{c}",
"is_2_28": "1",
}
)
continue
ans.append( ans.append(
{ {
"torch": torch, "torch": torch,
"python-version": p, "python-version": p,
"cuda": c, "cuda": c,
"image": f"pytorch/manylinux-builder:cuda{c}", "image": f"pytorch/manylinux-builder:cuda{c}",
"is_2_28": "0",
} }
) )
else: else:
@ -205,15 +400,53 @@ def generate_build_matrix(enable_cuda, for_windows, for_macos, test_only_latest_
if p in excluded_python_versions: if p in excluded_python_versions:
continue continue
if for_windows or for_macos: if for_windows:
p = "cp" + "".join(p.split("."))
ans.append({"torch": torch, "python-version": p}) ans.append({"torch": torch, "python-version": p})
elif for_macos:
ans.append({"torch": torch, "python-version": p})
elif version_ge(torch, "2.6.0"):
ans.append(
{
"torch": torch,
"python-version": p,
"image": "pytorch/manylinux2_28-builder:cpu"
if not for_arm64
else "pytorch/manylinux2_28_aarch64-builder:cpu-aarch64",
"is_2_28": "1",
}
)
elif version_ge(torch, "2.4.0"):
ans.append(
{
"torch": torch,
"python-version": p,
# "image": "pytorch/manylinux-builder:cpu-2.4",
"image": "pytorch/manylinux-builder:cpu-27677ead7c8293c299a885ae2c474bf445e653a5"
if not for_arm64
else "pytorch/manylinuxaarch64-builder:cpu-aarch64-195148266541a9789074265141cb7dc19dc14c54",
"is_2_28": "0",
}
)
elif version_ge(torch, "2.2.0"):
ans.append(
{
"torch": torch,
"python-version": p,
"image": "pytorch/manylinux-builder:cpu-2.2"
if not for_arm64
else "pytorch/manylinuxaarch64-builder:cpu-aarch64-195148266541a9789074265141cb7dc19dc14c54",
"is_2_28": "0",
}
)
else: else:
ans.append( ans.append(
{ {
"torch": torch, "torch": torch,
"python-version": p, "python-version": p,
"image": f"pytorch/manylinux-builder:cuda10.2", "image": "pytorch/manylinux-builder:cuda10.2"
if not for_arm64
else "pytorch/manylinuxaarch64-builder:cpu-aarch64-195148266541a9789074265141cb7dc19dc14c54",
"is_2_28": "0",
} }
) )
@ -226,6 +459,7 @@ def main():
enable_cuda=args.enable_cuda, enable_cuda=args.enable_cuda,
for_windows=args.for_windows, for_windows=args.for_windows,
for_macos=args.for_macos, for_macos=args.for_macos,
for_arm64=args.for_arm64,
test_only_latest_torch=args.test_only_latest_torch, test_only_latest_torch=args.test_only_latest_torch,
) )

View File

@ -55,6 +55,9 @@ case "$cuda" in
12.1) 12.1)
url=https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run url=https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run
;; ;;
12.4)
url=https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run
;;
*) *)
echo "Unknown cuda version: $cuda" echo "Unknown cuda version: $cuda"
exit 1 exit 1

View File

@ -48,6 +48,9 @@ case $cuda in
12.1) 12.1)
filename=cudnn-linux-x86_64-8.9.5.29_cuda12-archive.tar.xz filename=cudnn-linux-x86_64-8.9.5.29_cuda12-archive.tar.xz
;; ;;
12.4)
filename=cudnn-linux-x86_64-8.9.7.29_cuda12-archive.tar.xz
;;
*) *)
echo "Unsupported cuda version: $cuda" echo "Unsupported cuda version: $cuda"
exit 1 exit 1

View File

@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -x
if [ x"$TORCH_VERSION" != x"" ] && [ x"$CUDA_VERSION" != x"" ]; then if [ x"$TORCH_VERSION" != x"" ] && [ x"$CUDA_VERSION" != x"" ]; then
torch=$TORCH_VERSION torch=$TORCH_VERSION
cuda=$CUDA_VERSION cuda=$CUDA_VERSION
@ -185,6 +187,117 @@ case ${torch} in
;; ;;
esac esac
;; ;;
2.2.*)
case ${cuda} in
11.8)
package="torch==${torch}+cu118"
url=https://download.pytorch.org/whl/torch_stable.html
;;
12.1)
package="torch==${torch}"
# Leave it empty to use PyPI.
url=
;;
esac
;;
2.3.*)
case ${cuda} in
11.8)
package="torch==${torch}+cu118"
url=https://download.pytorch.org/whl/torch_stable.html
;;
12.1)
package="torch==${torch}"
# Leave it empty to use PyPI.
url=
;;
esac
;;
2.4.*)
case ${cuda} in
11.8)
package="torch==${torch}+cu118"
# https://download.pytorch.org/whl/nightly/torch/
url=https://download.pytorch.org/whl/torch/
;;
12.1)
package="torch==${torch}+cu121"
url=https://download.pytorch.org/whl/torch/
;;
12.4)
package="torch==${torch}+cu124"
url=https://download.pytorch.org/whl/torch/
;;
esac
;;
2.5.*)
case ${cuda} in
11.8)
package="torch==${torch}+cu118"
# https://download.pytorch.org/whl/nightly/torch/
url=https://download.pytorch.org/whl/torch/
;;
12.1)
package="torch==${torch}+cu121"
url=https://download.pytorch.org/whl/torch/
;;
12.4)
package="torch==${torch}+cu124"
url=https://download.pytorch.org/whl/torch/
;;
esac
;;
2.6.*)
case ${cuda} in
11.8)
package="torch==${torch}+cu118"
# https://download.pytorch.org/whl/nightly/torch/
url=https://download.pytorch.org/whl/torch/
;;
12.4)
package="torch==${torch}+cu124"
url=https://download.pytorch.org/whl/torch/
;;
12.6)
package="torch==${torch}+cu126"
url=https://download.pytorch.org/whl/torch/
;;
esac
;;
2.7.*)
case ${cuda} in
11.8)
package="torch==${torch}+cu118"
# https://download.pytorch.org/whl/nightly/torch/
url=https://download.pytorch.org/whl/torch/
;;
12.6)
package="torch==${torch}+cu126"
url=https://download.pytorch.org/whl/torch/
;;
12.8)
package="torch==${torch}+cu128"
url=https://download.pytorch.org/whl/torch/
;;
esac
;;
2.8.*)
case ${cuda} in
12.6)
package="torch==${torch}+cu126"
# https://download.pytorch.org/whl/nightly/torch/
url=https://download.pytorch.org/whl/torch/
;;
12.8)
package="torch==${torch}+cu128"
url=https://download.pytorch.org/whl/torch/
;;
12.9)
package="torch==${torch}+cu129"
url=https://download.pytorch.org/whl/torch/
;;
esac
;;
*) *)
echo "Unsupported PyTorch version: ${torch}" echo "Unsupported PyTorch version: ${torch}"
exit 1 exit 1
@ -201,4 +314,6 @@ else
retry python3 -m pip install -q $package -f $url retry python3 -m pip install -q $package -f $url
fi fi
rm -rfv ~/.cache/pip python3 -m torch.utils.collect_env
rm -rf ~/.cache/pip