diff --git a/.github/workflows/aishell.yml b/.github/workflows/aishell.yml index 8b0599fca..57224040b 100644 --- a/.github/workflows/aishell.yml +++ b/.github/workflows/aishell.yml @@ -31,8 +31,8 @@ jobs: id: set-matrix run: | # outputting for debugging purposes - python ./.github/scripts/docker/generate_build_matrix.py - MATRIX=$(python ./.github/scripts/docker/generate_build_matrix.py) + 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}" aishell: needs: generate_build_matrix diff --git a/.github/workflows/audioset.yml b/.github/workflows/audioset.yml index 9c9446239..90d418513 100644 --- a/.github/workflows/audioset.yml +++ b/.github/workflows/audioset.yml @@ -30,8 +30,8 @@ jobs: id: set-matrix run: | # outputting for debugging purposes - python ./.github/scripts/docker/generate_build_matrix.py - MATRIX=$(python ./.github/scripts/docker/generate_build_matrix.py) + 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}" audioset: @@ -83,7 +83,7 @@ jobs: ls -lh ./model-onnx/* - name: Upload model to huggingface - if: matrix.python-version == '3.9' && matrix.torch-version == '2.3.0' && github.event_name == 'push' + if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0' && github.event_name == 'push' env: HF_TOKEN: ${{ secrets.HF_TOKEN }} uses: nick-fields/retry@v3 @@ -116,7 +116,7 @@ jobs: rm -rf huggingface - name: Prepare for release - if: matrix.python-version == '3.9' && matrix.torch-version == '2.3.0' && github.event_name == 'push' + if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0' && github.event_name == 'push' shell: bash run: | d=sherpa-onnx-zipformer-audio-tagging-2024-04-09 @@ -125,7 +125,7 @@ jobs: ls -lh - name: Release exported onnx models - if: matrix.python-version == '3.9' && matrix.torch-version == '2.3.0' && github.event_name == 'push' + 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 diff --git a/.github/workflows/baker_zh.yml b/.github/workflows/baker_zh.yml index 7805ab5ab..044919fd8 100644 --- a/.github/workflows/baker_zh.yml +++ b/.github/workflows/baker_zh.yml @@ -31,8 +31,8 @@ jobs: id: set-matrix run: | # outputting for debugging purposes - python ./.github/scripts/docker/generate_build_matrix.py --min-torch-version "2.3" - MATRIX=$(python ./.github/scripts/docker/generate_build_matrix.py --min-torch-version "2.3") + 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}" baker_zh: @@ -84,43 +84,43 @@ jobs: ls -lh - uses: actions/upload-artifact@v4 - if: matrix.python-version == '3.9' && matrix.torch-version == '2.3.0' + 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 - uses: actions/upload-artifact@v4 - if: matrix.python-version == '3.9' && matrix.torch-version == '2.3.0' + 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.9' && matrix.torch-version == '2.3.0' + 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.9' && matrix.torch-version == '2.3.0' + 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.9' && matrix.torch-version == '2.3.0' + 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.9' && matrix.torch-version == '2.3.0' + 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.9' && matrix.torch-version == '2.3.0' && github.event_name == 'push' + if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0' && github.event_name == 'push' shell: bash env: HF_TOKEN: ${{ secrets.HF_TOKEN }} @@ -141,7 +141,7 @@ jobs: popd - name: Release exported onnx models - if: matrix.python-version == '3.9' && matrix.torch-version == '2.3.0' && github.event_name == 'push' + 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 diff --git a/.github/workflows/librispeech.yml b/.github/workflows/librispeech.yml index 6e087b10a..3b496fa57 100644 --- a/.github/workflows/librispeech.yml +++ b/.github/workflows/librispeech.yml @@ -29,8 +29,8 @@ jobs: id: set-matrix run: | # outputting for debugging purposes - python ./.github/scripts/docker/generate_build_matrix.py - MATRIX=$(python ./.github/scripts/docker/generate_build_matrix.py) + 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}" librispeech: needs: generate_build_matrix diff --git a/.github/workflows/ljspeech.yml b/.github/workflows/ljspeech.yml index 31a65cd94..52a3b1a3f 100644 --- a/.github/workflows/ljspeech.yml +++ b/.github/workflows/ljspeech.yml @@ -30,8 +30,8 @@ jobs: id: set-matrix run: | # outputting for debugging purposes - python ./.github/scripts/docker/generate_build_matrix.py --min-torch-version "2.3" - MATRIX=$(python ./.github/scripts/docker/generate_build_matrix.py --min-torch-version "2.3") + 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: @@ -83,13 +83,13 @@ jobs: ls -lh - uses: actions/upload-artifact@v4 - if: matrix.python-version == '3.9' && matrix.torch-version == '2.3.0' + 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.9' && matrix.torch-version == '2.3.0' && github.event_name == 'push' + 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 @@ -100,37 +100,37 @@ jobs: tag: tts-models - uses: actions/upload-artifact@v4 - if: matrix.python-version == '3.9' && matrix.torch-version == '2.3.0' + 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.9' && matrix.torch-version == '2.3.0' + 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.9' && matrix.torch-version == '2.3.0' + 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.9' && matrix.torch-version == '2.3.0' + 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.9' && matrix.torch-version == '2.3.0' + 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.9' && matrix.torch-version == '2.3.0' + if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0' shell: bash env: HF_TOKEN: ${{ secrets.HF_TOKEN }} @@ -155,7 +155,7 @@ jobs: popd - name: Release exported onnx models - if: matrix.python-version == '3.9' && matrix.torch-version == '2.3.0' + if: matrix.python-version == '3.10' && matrix.torch-version == '2.3.0' uses: svenstaro/upload-release-action@v2 with: file_glob: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c22f2edb5..075ca1c1c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,8 +30,7 @@ jobs: id: set-matrix run: | # outputting for debugging purposes - python ./.github/scripts/docker/generate_build_matrix.py - MATRIX=$(python ./.github/scripts/docker/generate_build_matrix.py) + MATRIX=$(python ./.github/scripts/docker/generate_build_matrix.py --min-torch-version "2.3") echo "::set-output name=matrix::${MATRIX}" test: needs: generate_build_matrix diff --git a/.github/workflows/yesno.yml b/.github/workflows/yesno.yml index a9d65516f..0735f3cee 100644 --- a/.github/workflows/yesno.yml +++ b/.github/workflows/yesno.yml @@ -30,8 +30,8 @@ jobs: id: set-matrix run: | # outputting for debugging purposes - python ./.github/scripts/docker/generate_build_matrix.py - MATRIX=$(python ./.github/scripts/docker/generate_build_matrix.py) + 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}" yesno: needs: generate_build_matrix diff --git a/egs/baker_zh/TTS/local/compute_fbank_baker_zh.py b/egs/baker_zh/TTS/local/compute_fbank_baker_zh.py index 0720158f2..deb344d14 100755 --- a/egs/baker_zh/TTS/local/compute_fbank_baker_zh.py +++ b/egs/baker_zh/TTS/local/compute_fbank_baker_zh.py @@ -73,6 +73,8 @@ def compute_fbank_baker_zh(num_jobs: int): f_min=0, f_max=8000, ) + if not torch.cuda.is_available(): + config.device = "cpu" prefix = "baker_zh" suffix = "jsonl.gz" diff --git a/egs/ljspeech/TTS/local/compute_fbank_ljspeech.py b/egs/ljspeech/TTS/local/compute_fbank_ljspeech.py index 296f9a4f4..906025b7f 100755 --- a/egs/ljspeech/TTS/local/compute_fbank_ljspeech.py +++ b/egs/ljspeech/TTS/local/compute_fbank_ljspeech.py @@ -73,6 +73,8 @@ def compute_fbank_ljspeech(num_jobs: int): f_min=0, f_max=8000, ) + if not torch.cuda.is_available(): + config.device = "cpu" prefix = "ljspeech" suffix = "jsonl.gz" diff --git a/icefall/checkpoint.py b/icefall/checkpoint.py index d31ce1301..f98045d29 100644 --- a/icefall/checkpoint.py +++ b/icefall/checkpoint.py @@ -110,7 +110,7 @@ def load_checkpoint( TODO: document it """ logging.info(f"Loading checkpoint from {filename}") - checkpoint = torch.load(filename, map_location="cpu") + checkpoint = torch.load(filename, map_location="cpu", weights_only=False) if next(iter(checkpoint["model"])).startswith("module."): logging.info("Loading checkpoint saved by DDP") @@ -163,7 +163,7 @@ def average_checkpoints( """ n = len(filenames) - avg = torch.load(filenames[0], map_location=device)["model"] + avg = torch.load(filenames[0], map_location=device, weights_only=False)["model"] # Identify shared parameters. Two parameters are said to be shared # if they have the same data_ptr @@ -178,7 +178,9 @@ def average_checkpoints( uniqued_names = list(uniqued.values()) for i in range(1, n): - state_dict = torch.load(filenames[i], map_location=device)["model"] + state_dict = torch.load(filenames[i], map_location=device, weights_only=False)[ + "model" + ] for k in uniqued_names: avg[k] += state_dict[k] @@ -421,8 +423,10 @@ def average_checkpoints_with_averaged_model( device: Move checkpoints to this device before averaging. """ - state_dict_start = torch.load(filename_start, map_location=device) - state_dict_end = torch.load(filename_end, map_location=device) + state_dict_start = torch.load( + filename_start, map_location=device, weights_only=False + ) + state_dict_end = torch.load(filename_end, map_location=device, weights_only=False) average_period = state_dict_start["average_period"]