Support onnxruntime 1.18.0 (#906)
This commit is contained in:
@@ -28,11 +28,17 @@ def add_meta_data(filename: str, meta_data: Dict[str, str]):
|
||||
Key-value pairs.
|
||||
"""
|
||||
model = onnx.load(filename)
|
||||
|
||||
while len(model.metadata_props):
|
||||
model.metadata_props.pop()
|
||||
|
||||
for key, value in meta_data.items():
|
||||
meta = model.metadata_props.add()
|
||||
meta.key = key
|
||||
meta.value = str(value)
|
||||
|
||||
# model = onnx.version_converter.convert_version(model, 21)
|
||||
|
||||
onnx.save(model, filename)
|
||||
|
||||
|
||||
|
||||
@@ -32,11 +32,17 @@ def add_meta_data(filename: str, meta_data: Dict[str, str]):
|
||||
Key-value pairs.
|
||||
"""
|
||||
model = onnx.load(filename)
|
||||
|
||||
while len(model.metadata_props):
|
||||
model.metadata_props.pop()
|
||||
|
||||
for key, value in meta_data.items():
|
||||
meta = model.metadata_props.add()
|
||||
meta.key = key
|
||||
meta.value = str(value)
|
||||
|
||||
# model = onnx.version_converter.convert_version(model, 21)
|
||||
|
||||
onnx.save(model, filename)
|
||||
|
||||
|
||||
@@ -87,6 +93,7 @@ def main():
|
||||
x = torch.rand(N, T, C, dtype=torch.float)
|
||||
x_lens = torch.full((N,), fill_value=T, dtype=torch.int64)
|
||||
|
||||
# https://github.com/pytorch/pytorch/issues/114801
|
||||
opset_version = 13
|
||||
onnx_model = torch.jit.script(onnx_model)
|
||||
torch.onnx.export(
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
|
||||
set -ex
|
||||
|
||||
export PYTHONPATH=/tmp/wenet:$PYTHONPATH
|
||||
|
||||
function install_dependencies() {
|
||||
pip install soundfile
|
||||
pip install torch==2.1.0+cpu torchaudio==2.1.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
||||
pip install k2==1.24.4.dev20231022+cpu.torch2.1.0 -f https://k2-fsa.github.io/k2/cpu.html
|
||||
pip install torch==2.3.1+cpu torchaudio==2.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
||||
pip install k2==1.24.4.dev20240606+cpu.torch2.3.1 -f https://k2-fsa.github.io/k2/cpu.html
|
||||
|
||||
pip install onnxruntime onnx kaldi-native-fbank pyyaml
|
||||
|
||||
@@ -31,7 +33,11 @@ function install_dependencies() {
|
||||
cp -a ./wenet/wenet/ctl_model $wenet_dir
|
||||
fi
|
||||
|
||||
rm -rf wenet
|
||||
if [ ! -d $wenet_dir/finetune ]; then
|
||||
cp -av ./wenet/wenet/finetune $wenet_dir/
|
||||
fi
|
||||
|
||||
mv wenet /tmp
|
||||
}
|
||||
|
||||
function aishell() {
|
||||
|
||||
Reference in New Issue
Block a user