This commit is contained in:
Fangjun Kuang 2024-12-30 17:49:04 +08:00
parent 2c7ad4d1b0
commit 405e9e8fb4
3 changed files with 26 additions and 4 deletions

View File

@ -5,6 +5,15 @@
import json import json
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--min-torch-version",
help="Minimu torch version",
)
return parser.parse_args()
def version_gt(a, b): def version_gt(a, b):
a_major, a_minor = list(map(int, a.split(".")))[:2] a_major, a_minor = list(map(int, a.split(".")))[:2]
b_major, b_minor = list(map(int, b.split(".")))[:2] b_major, b_minor = list(map(int, b.split(".")))[:2]
@ -42,7 +51,7 @@ def get_torchaudio_version(torch_version):
return torch_version return torch_version
def get_matrix(): def get_matrix(min_torch_version):
k2_version = "1.24.4.dev20241029" k2_version = "1.24.4.dev20241029"
kaldifeat_version = "1.25.5.dev20241029" kaldifeat_version = "1.25.5.dev20241029"
version = "20241218" version = "20241218"
@ -64,6 +73,9 @@ def get_matrix():
matrix = [] matrix = []
for p in python_version: for p in python_version:
for t in torch_version: for t in torch_version:
if min_torch_version and version_gt(min_torch_version, t):
continue
# torchaudio <= 1.13.x supports only python <= 3.10 # torchaudio <= 1.13.x supports only python <= 3.10
if version_gt(p, "3.10") and not version_gt(t, "2.0"): if version_gt(p, "3.10") and not version_gt(t, "2.0"):
@ -101,7 +113,8 @@ def get_matrix():
def main(): def main():
matrix = get_matrix() args = get_args()
matrix = get_matrix(min_torch_version=args.min_torch_version)
print(json.dumps({"include": matrix})) print(json.dumps({"include": matrix}))

View File

@ -31,8 +31,8 @@ jobs:
id: set-matrix id: set-matrix
run: | run: |
# outputting for debugging purposes # outputting for debugging purposes
python ./.github/scripts/docker/generate_build_matrix.py python ./.github/scripts/docker/generate_build_matrix.py --min-torch-version "2.3"
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}" echo "::set-output name=matrix::${MATRIX}"
baker_zh: baker_zh:

View File

@ -81,6 +81,15 @@ The above command generate the following files:
where the 2 in `model-steps-2.onnx` means it uses 2 steps for the ODE solver. where the 2 in `model-steps-2.onnx` means it uses 2 steps for the ODE solver.
**HINT**: If you get the following error while running `export_onnx.py`:
```
torch.onnx.errors.UnsupportedOperatorError: Exporting the operator
'aten::scaled_dot_product_attention' to ONNX opset version 14 is not supported.
```
please use `torch>=2.2.0`.
To export the Hifigan vocoder to onnx, please use: To export the Hifigan vocoder to onnx, please use:
```bash ```bash