Use cpu docker to run the test

This commit is contained in:
Fangjun Kuang 2023-12-23 22:08:39 +08:00
parent 79a42148db
commit f95fcd7d11
2 changed files with 47 additions and 93 deletions

View File

@ -1,129 +1,85 @@
# Copyright 2021 Fangjun Kuang (csukuangfj@gmail.com)
# See ../../LICENSE for clarification regarding multiple authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: test name: test
on: on:
push: push:
branches: branches:
- master - master
- refactor-ci
pull_request: pull_request:
branches: branches:
- master - master
workflow_dispatch:
concurrency: concurrency:
group: test-${{ github.ref }} group: test-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
test: test:
name: py${{ matrix.python-version }} torch${{ matrix.torch-version }} v${{ matrix.version }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
python-version: ["3.8"] python-version: ["3.8", "3.9", "3.10"]
torch: ["1.13.0"] torch-version: ["1.13.0", "2.0.0", "2.0.1", "2.1.0", "2.1.1", "2.1.2"]
torchaudio: ["0.13.0"] version: ["1.0"]
k2-version: ["1.24.3.dev20230719"]
fail-fast: false
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install libnsdfile and libsox
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt update
sudo apt install -q -y libsndfile1-dev libsndfile1 ffmpeg
sudo apt install -q -y --fix-missing libsox-dev libsox-fmt-all
- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip pytest
# numpy 1.20.x does not support python 3.6
pip install numpy==1.19
pip install torch==${{ matrix.torch }}+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
pip install torchaudio==${{ matrix.torchaudio }}+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
pip install k2==${{ matrix.k2-version }}+cpu.torch${{ matrix.torch }} -f https://k2-fsa.github.io/k2/cpu.html
pip install git+https://github.com/lhotse-speech/lhotse
# icefall requirements
pip uninstall -y protobuf
pip install --no-binary protobuf protobuf==3.20.*
pip install kaldifst
pip install onnxruntime matplotlib
pip install -r requirements.txt
- name: Install graphviz
if: startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
python3 -m pip install -qq graphviz
sudo apt-get -qq install graphviz
- name: Run tests - name: Run tests
if: startsWith(matrix.os, 'ubuntu') uses: addnab/docker-run-action@v3
run: | with:
ls -lh image: ghcr.io/k2-fsa/icefall:cpu-py${{ matrix.python-version }}-torch${{ matrix.torch-version }}-v${{ matrix.version }}
export PYTHONPATH=$PWD:$PWD/lhotse:$PYTHONPATH options: |
echo $PYTHONPATH --volume ${{ github.workspace }}/:/icefall
pytest -v -s ./test shell: bash
# runt tests for conformer ctc run: |
cd egs/librispeech/ASR/conformer_ctc export PYTHONPATH=/icefall:$PYTHONPATH
pytest -v -s cd /icefall
cd ../pruned_transducer_stateless pytest -v -s ./test
pytest -v -s
cd ../pruned_transducer_stateless2 # runt tests for conformer ctc
pytest -v -s cd egs/librispeech/ASR/conformer_ctc
pytest -v -s
cd ../pruned_transducer_stateless3 cd ../pruned_transducer_stateless
pytest -v -s pytest -v -s
cd ../pruned_transducer_stateless4 cd ../pruned_transducer_stateless2
pytest -v -s pytest -v -s
echo $PYTHONPATH cd ../pruned_transducer_stateless3
cd ../pruned_transducer_stateless7 pytest -v -s
pytest -v -s
cd ../transducer_stateless cd ../pruned_transducer_stateless4
pytest -v -s pytest -v -s
# cd ../transducer echo $PYTHONPATH
# pytest -v -s cd ../pruned_transducer_stateless7
pytest -v -s
cd ../transducer_stateless2 cd ../transducer_stateless
pytest -v -s pytest -v -s
cd ../transducer_lstm # cd ../transducer
pytest -v -s # pytest -v -s
cd ../zipformer cd ../transducer_stateless2
pytest -v -s pytest -v -s
cd ../transducer_lstm
pytest -v -s
cd ../zipformer
pytest -v -s
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:

View File

@ -24,8 +24,6 @@ jobs:
os: [ubuntu-latest] os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10"] python-version: ["3.8", "3.9", "3.10"]
torch-version: ["1.13.0", "2.0.0", "2.0.1", "2.1.0", "2.1.1", "2.1.2"] torch-version: ["1.13.0", "2.0.0", "2.0.1", "2.1.0", "2.1.1", "2.1.2"]
k2-version: ["1.24.4.dev20231220"]
kaldifeat-version: ["1.25.3.dev20231221"]
version: ["1.0"] version: ["1.0"]
steps: steps:
@ -43,7 +41,7 @@ jobs:
echo "pwd: $PWD" echo "pwd: $PWD"
echo "github.workspace ${{ github.workspace }}" echo "github.workspace ${{ github.workspace }}"
- name: Run the build process with Docker - name: Test zipformer/train.py with LibriSpeech
uses: addnab/docker-run-action@v3 uses: addnab/docker-run-action@v3
with: with:
image: ghcr.io/k2-fsa/icefall:cpu-py${{ matrix.python-version }}-torch${{ matrix.torch-version }}-v${{ matrix.version }} image: ghcr.io/k2-fsa/icefall:cpu-py${{ matrix.python-version }}-torch${{ matrix.torch-version }}-v${{ matrix.version }}