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
167 lines
5.0 KiB
YAML
167 lines
5.0 KiB
YAML
name: ljspeech
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ljspeech-${{ 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}"
|
|
|
|
ljspeech:
|
|
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: |
|
|
ls -lh
|
|
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
|
|
|
|
pip install "matplotlib<=3.9.4"
|
|
|
|
pip list
|
|
|
|
.github/scripts/ljspeech/TTS/run-matcha.sh
|
|
.github/scripts/ljspeech/TTS/run.sh
|
|
|
|
- name: display files
|
|
shell: bash
|
|
run: |
|
|
ls -lh
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0'
|
|
with:
|
|
name: generated-test-files-${{ matrix.python-version }}-${{ matrix.torch-version }}
|
|
path: ./*.wav
|
|
|
|
- name: Release exported onnx models
|
|
if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0' && github.event_name == 'push'
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
file_glob: true
|
|
overwrite: true
|
|
file: vits-icefall-*.tar.bz2
|
|
repo_name: k2-fsa/sherpa-onnx
|
|
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
|
|
tag: tts-models
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0'
|
|
with:
|
|
name: step-2
|
|
path: ./model-steps-2.onnx
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0'
|
|
with:
|
|
name: step-3
|
|
path: ./model-steps-3.onnx
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0'
|
|
with:
|
|
name: step-4
|
|
path: ./model-steps-4.onnx
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0'
|
|
with:
|
|
name: step-5
|
|
path: ./model-steps-5.onnx
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0'
|
|
with:
|
|
name: step-6
|
|
path: ./model-steps-6.onnx
|
|
|
|
- name: Upload models to huggingface
|
|
if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0'
|
|
shell: bash
|
|
env:
|
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
|
run: |
|
|
d=matcha-icefall-en_US-ljspeech
|
|
|
|
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/$d hf
|
|
cp -av $d/* hf/
|
|
|
|
pushd hf
|
|
|
|
git lfs track "cmn_dict"
|
|
git lfs track "ru_dict"
|
|
|
|
git add .
|
|
|
|
git config --global user.name "csukuangfj"
|
|
git config --global user.email "csukuangfj@gmail.com"
|
|
git config --global lfs.allowincompletepush true
|
|
|
|
git commit -m "upload model" && git push https://csukuangfj:${HF_TOKEN}@huggingface.co/csukuangfj/$d main || true
|
|
popd
|
|
|
|
- name: Release exported onnx models
|
|
if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0'
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
file_glob: true
|
|
overwrite: true
|
|
file: matcha-icefall-*.tar.bz2
|
|
repo_name: k2-fsa/sherpa-onnx
|
|
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
|
|
tag: tts-models
|