Add PengChengStarling models to sherpa-onnx (#1835)
This commit is contained in:
22
scripts/peng-cheng-starling/quantize_models.py
Executable file
22
scripts/peng-cheng-starling/quantize_models.py
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
from onnxruntime.quantization import QuantType, quantize_dynamic
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
suffix = "epoch-75-avg-11-chunk-16-left-128"
|
||||
|
||||
for m in ["encoder", "joiner"]:
|
||||
if Path(f"{m}-{suffix}.int8.onnx").is_file():
|
||||
continue
|
||||
|
||||
quantize_dynamic(
|
||||
model_input=f"./{m}-{suffix}.onnx",
|
||||
model_output=f"./{m}-{suffix}.int8.onnx",
|
||||
op_types_to_quantize=["MatMul"],
|
||||
weight_type=QuantType.QInt8,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user