-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate the dependency matrix by code for GitHub Actions (#1431)
- Loading branch information
1 parent
e5bb1ae
commit c855a58
Showing
8 changed files
with
280 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright 2023 Xiaomi Corp. (authors: Fangjun Kuang) | ||
|
||
|
||
import json | ||
|
||
|
||
def version_gt(a, b): | ||
a_major, a_minor = a.split(".")[:2] | ||
b_major, b_minor = b.split(".")[:2] | ||
if a_major > b_major: | ||
return True | ||
|
||
if a_major == b_major and a_minor > b_minor: | ||
return True | ||
|
||
return False | ||
|
||
|
||
def version_ge(a, b): | ||
a_major, a_minor = a.split(".")[:2] | ||
b_major, b_minor = b.split(".")[:2] | ||
if a_major > b_major: | ||
return True | ||
|
||
if a_major == b_major and a_minor >= b_minor: | ||
return True | ||
|
||
return False | ||
|
||
|
||
def get_torchaudio_version(torch_version): | ||
if torch_version == "1.13.0": | ||
return "0.13.0" | ||
elif torch_version == "1.13.1": | ||
return "0.13.1" | ||
elif torch_version == "2.0.0": | ||
return "2.0.1" | ||
elif torch_version == "2.0.1": | ||
return "2.0.2" | ||
else: | ||
return torch_version | ||
|
||
|
||
def get_matrix(): | ||
k2_version = "1.24.4.dev20231220" | ||
kaldifeat_version = "1.25.3.dev20231221" | ||
version = "1.1" | ||
python_version = ["3.8", "3.9", "3.10", "3.11"] | ||
torch_version = ["1.13.0", "1.13.1", "2.0.0", "2.0.1", "2.1.0", "2.1.1", "2.1.2"] | ||
|
||
matrix = [] | ||
for p in python_version: | ||
for t in torch_version: | ||
# torchaudio <= 1.13.x supports only python <= 3.10 | ||
|
||
if version_gt(p, "3.10") and not version_gt(t, "2.0"): | ||
continue | ||
|
||
matrix.append( | ||
{ | ||
"k2-version": k2_version, | ||
"kaldifeat-version": kaldifeat_version, | ||
"version": version, | ||
"python-version": p, | ||
"torch-version": t, | ||
"torchaudio-version": get_torchaudio_version(t), | ||
} | ||
) | ||
return matrix | ||
|
||
|
||
def main(): | ||
matrix = get_matrix() | ||
print(json.dumps({"include": matrix})) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
11 changes: 6 additions & 5 deletions
11
.github/scripts/docker/run.sh → .github/scripts/librispeech/ASR/run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
log() { | ||
# This function is from espnet | ||
local fname=${BASH_SOURCE[1]##*/} | ||
echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*" | ||
} | ||
|
||
cd egs/yesno/ASR | ||
|
||
log "data preparation" | ||
./prepare.sh | ||
|
||
log "training" | ||
python3 ./tdnn/train.py | ||
|
||
log "decoding" | ||
python3 ./tdnn/decode.py | ||
|
||
log "export to pretrained.pt" | ||
|
||
python3 ./tdnn/export.py --epoch 14 --avg 2 | ||
|
||
python3 ./tdnn/pretrained.py \ | ||
--checkpoint ./tdnn/exp/pretrained.pt \ | ||
--HLG ./data/lang_phone/HLG.pt \ | ||
--words-file ./data/lang_phone/words.txt \ | ||
download/waves_yesno/0_0_0_1_0_0_0_1.wav \ | ||
download/waves_yesno/0_0_1_0_0_0_1_0.wav | ||
|
||
log "Test exporting to torchscript" | ||
python3 ./tdnn/export.py --epoch 14 --avg 2 --jit 1 | ||
|
||
python3 ./tdnn/jit_pretrained.py \ | ||
--nn-model ./tdnn/exp/cpu_jit.pt \ | ||
--HLG ./data/lang_phone/HLG.pt \ | ||
--words-file ./data/lang_phone/words.txt \ | ||
download/waves_yesno/0_0_0_1_0_0_0_1.wav \ | ||
download/waves_yesno/0_0_1_0_0_0_1_0.wav | ||
|
||
log "Test exporting to onnx" | ||
python3 ./tdnn/export_onnx.py --epoch 14 --avg 2 | ||
|
||
log "Test float32 model" | ||
python3 ./tdnn/onnx_pretrained.py \ | ||
--nn-model ./tdnn/exp/model-epoch-14-avg-2.onnx \ | ||
--HLG ./data/lang_phone/HLG.pt \ | ||
--words-file ./data/lang_phone/words.txt \ | ||
download/waves_yesno/0_0_0_1_0_0_0_1.wav \ | ||
download/waves_yesno/0_0_1_0_0_0_1_0.wav | ||
|
||
log "Test int8 model" | ||
python3 ./tdnn/onnx_pretrained.py \ | ||
--nn-model ./tdnn/exp/model-epoch-14-avg-2.int8.onnx \ | ||
--HLG ./data/lang_phone/HLG.pt \ | ||
--words-file ./data/lang_phone/words.txt \ | ||
download/waves_yesno/0_0_0_1_0_0_0_1.wav \ | ||
download/waves_yesno/0_0_1_0_0_0_1_0.wav | ||
|
||
log "Test decoding with H" | ||
python3 ./tdnn/export.py --epoch 14 --avg 2 --jit 1 | ||
|
||
python3 ./tdnn/jit_pretrained_decode_with_H.py \ | ||
--nn-model ./tdnn/exp/cpu_jit.pt \ | ||
--H ./data/lang_phone/H.fst \ | ||
--tokens ./data/lang_phone/tokens.txt \ | ||
./download/waves_yesno/0_0_0_1_0_0_0_1.wav \ | ||
./download/waves_yesno/0_0_1_0_0_0_1_0.wav \ | ||
./download/waves_yesno/0_0_1_0_0_1_1_1.wav | ||
|
||
log "Test decoding with HL" | ||
python3 ./tdnn/export.py --epoch 14 --avg 2 --jit 1 | ||
|
||
python3 ./tdnn/jit_pretrained_decode_with_HL.py \ | ||
--nn-model ./tdnn/exp/cpu_jit.pt \ | ||
--HL ./data/lang_phone/HL.fst \ | ||
--words ./data/lang_phone/words.txt \ | ||
./download/waves_yesno/0_0_0_1_0_0_0_1.wav \ | ||
./download/waves_yesno/0_0_1_0_0_0_1_0.wav \ | ||
./download/waves_yesno/0_0_1_0_0_1_1_1.wav | ||
|
||
log "Show generated files" | ||
ls -lh tdnn/exp | ||
ls -lh data/lang_phone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.