mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-08 09:32:20 +00:00
- Introduce unified AMP helpers (create_grad_scaler, torch_autocast) to handle deprecations in PyTorch ≥2.3.0 - Replace direct uses of torch.cuda.amp.GradScaler and torch.cuda.amp.autocast with the new utilities across all training and inference scripts - Update all torch.load calls to include weights_only=False for compatibility with newer PyTorch versions
112 lines
3.0 KiB
YAML
112 lines
3.0 KiB
YAML
name: test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: test-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
generate_build_matrix:
|
|
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
|
|
# 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 ./.github/scripts/docker/generate_build_matrix.py --python-version "3.10"
|
|
MATRIX=$(python ./.github/scripts/docker/generate_build_matrix.py --python-version "3.10")
|
|
echo "::set-output name=matrix::${MATRIX}"
|
|
test:
|
|
needs: generate_build_matrix
|
|
name: py${{ matrix.python-version }} torch${{ matrix.torch-version }} v${{ matrix.version }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
${{ fromJson(needs.generate_build_matrix.outputs.matrix) }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
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 }}"
|
|
|
|
- name: Run tests
|
|
uses: addnab/docker-run-action@v3
|
|
with:
|
|
image: ghcr.io/${{ github.repository_owner }}/icefall:cpu-py${{ matrix.python-version }}-torch${{ matrix.torch-version }}-v${{ matrix.version }}
|
|
options: |
|
|
--volume ${{ github.workspace }}/:/icefall
|
|
shell: bash
|
|
run: |
|
|
export PYTHONPATH=/icefall:$PYTHONPATH
|
|
cd /icefall
|
|
git config --global --add safe.directory /icefall
|
|
|
|
pytest -v -s ./test
|
|
|
|
# runt tests for conformer ctc
|
|
cd egs/librispeech/ASR/conformer_ctc
|
|
pytest -v -s
|
|
|
|
cd ../pruned_transducer_stateless
|
|
pytest -v -s
|
|
|
|
cd ../pruned_transducer_stateless2
|
|
pytest -v -s
|
|
|
|
cd ../pruned_transducer_stateless3
|
|
pytest -v -s
|
|
|
|
cd ../pruned_transducer_stateless4
|
|
pytest -v -s
|
|
|
|
echo $PYTHONPATH
|
|
cd ../pruned_transducer_stateless7
|
|
pytest -v -s
|
|
|
|
cd ../transducer_stateless
|
|
pytest -v -s
|
|
|
|
# cd ../transducer
|
|
# pytest -v -s
|
|
|
|
cd ../transducer_stateless2
|
|
pytest -v -s
|
|
|
|
cd ../transducer_lstm
|
|
pytest -v -s
|
|
|
|
cd ../zipformer
|
|
pytest -v -s
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
path: egs/librispeech/ASR/zipformer/swoosh.pdf
|
|
name: swoosh-${{ matrix.python-version }}-${{ matrix.torch-version }}
|