mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-09 01:52:41 +00:00
Use the CPU docker in CI to simplify the test code (#1427)
This commit is contained in:
parent
79a42148db
commit
e5bb1ae86c
21
.github/scripts/docker/Dockerfile
vendored
21
.github/scripts/docker/Dockerfile
vendored
@ -14,6 +14,7 @@ RUN apt-get update -y && \
|
|||||||
ffmpeg \
|
ffmpeg \
|
||||||
git \
|
git \
|
||||||
git-lfs \
|
git-lfs \
|
||||||
|
graphviz \
|
||||||
less \
|
less \
|
||||||
vim \
|
vim \
|
||||||
&& \
|
&& \
|
||||||
@ -32,23 +33,23 @@ RUN pip install --no-cache-dir \
|
|||||||
k2==${_K2_VERSION} -f https://k2-fsa.github.io/k2/cpu.html \
|
k2==${_K2_VERSION} -f https://k2-fsa.github.io/k2/cpu.html \
|
||||||
git+https://github.com/lhotse-speech/lhotse \
|
git+https://github.com/lhotse-speech/lhotse \
|
||||||
kaldifeat==${_KALDIFEAT_VERSION} -f https://csukuangfj.github.io/kaldifeat/cpu.html \
|
kaldifeat==${_KALDIFEAT_VERSION} -f https://csukuangfj.github.io/kaldifeat/cpu.html \
|
||||||
|
dill \
|
||||||
|
graphviz \
|
||||||
kaldi_native_io \
|
kaldi_native_io \
|
||||||
kaldialign \
|
kaldialign \
|
||||||
kaldifst \
|
kaldifst \
|
||||||
kaldilm \
|
kaldilm \
|
||||||
sentencepiece>=0.1.96 \
|
matplotlib \
|
||||||
tensorboard \
|
|
||||||
typeguard \
|
|
||||||
dill \
|
|
||||||
onnx \
|
|
||||||
onnxruntime \
|
|
||||||
onnxmltools \
|
|
||||||
six \
|
|
||||||
multi_quantization \
|
multi_quantization \
|
||||||
typeguard \
|
|
||||||
numpy \
|
numpy \
|
||||||
|
onnx \
|
||||||
|
onnxmltools \
|
||||||
|
onnxruntime \
|
||||||
pytest \
|
pytest \
|
||||||
graphviz
|
sentencepiece>=0.1.96 \
|
||||||
|
six \
|
||||||
|
tensorboard \
|
||||||
|
typeguard
|
||||||
|
|
||||||
# RUN git clone https://github.com/k2-fsa/icefall /workspace/icefall && \
|
# RUN git clone https://github.com/k2-fsa/icefall /workspace/icefall && \
|
||||||
# cd /workspace/icefall && \
|
# cd /workspace/icefall && \
|
||||||
|
8
.github/workflows/build-cpu-docker.yml
vendored
8
.github/workflows/build-cpu-docker.yml
vendored
@ -15,10 +15,10 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
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", "1.13.1", "2.0.0", "2.0.1", "2.1.0", "2.1.1", "2.1.2"]
|
||||||
k2-version: ["1.24.4.dev20231220"]
|
k2-version: ["1.24.4.dev20231220"]
|
||||||
kaldifeat-version: ["1.25.3.dev20231221"]
|
kaldifeat-version: ["1.25.3.dev20231221"]
|
||||||
version: ["1.0"]
|
version: ["1.1"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# refer to https://github.com/actions/checkout
|
# refer to https://github.com/actions/checkout
|
||||||
@ -45,8 +45,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd .github/scripts/docker
|
cd .github/scripts/docker
|
||||||
torch_version=${{ matrix.torch-version }}
|
torch_version=${{ matrix.torch-version }}
|
||||||
|
|
||||||
|
# see https://pytorch.org/audio/stable/installation.html#compatibility-matrix
|
||||||
if [[ $torch_version == 1.13.0 ]]; then
|
if [[ $torch_version == 1.13.0 ]]; then
|
||||||
torchaudio_version=0.13.0
|
torchaudio_version=0.13.0
|
||||||
|
elif [[ $torch_version == 1.13.1 ]]; then
|
||||||
|
torchaudio_version=0.13.1
|
||||||
elif [[ $torch_version == 2.0.0 ]]; then
|
elif [[ $torch_version == 2.0.0 ]]; then
|
||||||
torchaudio_version=2.0.1
|
torchaudio_version=2.0.1
|
||||||
elif [[ $torch_version == 2.0.1 ]]; then
|
elif [[ $torch_version == 2.0.1 ]]; then
|
||||||
|
87
.github/workflows/test.yml
vendored
87
.github/workflows/test.yml
vendored
@ -1,95 +1,60 @@
|
|||||||
# 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
|
||||||
|
|
||||||
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", "1.13.1", "2.0.0", "2.0.1", "2.1.0", "2.1.1", "2.1.2"]
|
||||||
torchaudio: ["0.13.0"]
|
version: ["1.1"]
|
||||||
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 }}
|
- name: Free space
|
||||||
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
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install -qq graphviz
|
df -h
|
||||||
sudo apt-get -qq install graphviz
|
rm -rf /opt/hostedtoolcache
|
||||||
|
df -h
|
||||||
|
echo "pwd: $PWD"
|
||||||
|
echo "github.workspace ${{ github.workspace }}"
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
uses: addnab/docker-run-action@v3
|
||||||
|
with:
|
||||||
|
image: ghcr.io/k2-fsa/icefall:cpu-py${{ matrix.python-version }}-torch${{ matrix.torch-version }}-v${{ matrix.version }}
|
||||||
|
options: |
|
||||||
|
--volume ${{ github.workspace }}/:/icefall
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
ls -lh
|
export PYTHONPATH=/icefall:$PYTHONPATH
|
||||||
export PYTHONPATH=$PWD:$PWD/lhotse:$PYTHONPATH
|
cd /icefall
|
||||||
echo $PYTHONPATH
|
git config --global --add safe.directory /icefall
|
||||||
|
|
||||||
pytest -v -s ./test
|
pytest -v -s ./test
|
||||||
|
|
||||||
# runt tests for conformer ctc
|
# runt tests for conformer ctc
|
||||||
cd egs/librispeech/ASR/conformer_ctc
|
cd egs/librispeech/ASR/conformer_ctc
|
||||||
pytest -v -s
|
pytest -v -s
|
||||||
|
8
.github/workflows/train-librispeech.yml
vendored
8
.github/workflows/train-librispeech.yml
vendored
@ -23,10 +23,8 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
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", "1.13.1", "2.0.0", "2.0.1", "2.1.0", "2.1.1", "2.1.2"]
|
||||||
k2-version: ["1.24.4.dev20231220"]
|
version: ["1.1"]
|
||||||
kaldifeat-version: ["1.25.3.dev20231221"]
|
|
||||||
version: ["1.0"]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# refer to https://github.com/actions/checkout
|
# refer to https://github.com/actions/checkout
|
||||||
@ -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 }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user