modrec-workflow/scripts/ort/convert_to_ort.py

26 lines
576 B
Python
Raw Normal View History

2025-06-16 13:43:59 -04:00
import subprocess
from helpers.app_settings import get_app_settings
settings = get_app_settings()
2025-06-18 13:59:48 -04:00
input_path = "onnx_files/inference_recognition_model.onnx"
2025-06-16 13:43:59 -04:00
optimization_style = settings.app.optimization_style
2025-06-18 14:27:08 -04:00
target_platform = settings.app.target_platform
2025-06-16 13:43:59 -04:00
# Build the command
command = [
"python",
"-m",
"onnxruntime.tools.convert_onnx_models_to_ort",
input_path,
"--output_dir",
"ort_files",
"--optimization_style",
optimization_style,
"--target_platform",
target_platform,
2025-06-16 13:43:59 -04:00
]
2025-06-18 14:27:08 -04:00
# Run the command
2025-06-16 13:43:59 -04:00
subprocess.run(command, check=True)