mirror of
https://github.com/dscripka/openWakeWord.git
synced 2026-08-27 18:17:20 -04:00
put onnx to tflite conversion behind flag in training code
This commit is contained in:
parent
af923e1d57
commit
368c03716d
1 changed files with 10 additions and 2 deletions
|
|
@ -630,6 +630,13 @@ if __name__ == '__main__':
|
||||||
default="False",
|
default="False",
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--convert_to_tflite",
|
||||||
|
help="Convert the trained ONNX model to TFLite format",
|
||||||
|
action="store_true",
|
||||||
|
default="False",
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
config = yaml.load(open(args.training_config, 'r').read(), yaml.Loader)
|
config = yaml.load(open(args.training_config, 'r').read(), yaml.Loader)
|
||||||
|
|
@ -898,5 +905,6 @@ if __name__ == '__main__':
|
||||||
oww.export_model(model=best_model, model_name=config["model_name"], output_dir=config["output_dir"])
|
oww.export_model(model=best_model, model_name=config["model_name"], output_dir=config["output_dir"])
|
||||||
|
|
||||||
# Convert the model from onnx to tflite format
|
# Convert the model from onnx to tflite format
|
||||||
convert_onnx_to_tflite(os.path.join(config["output_dir"], config["model_name"] + ".onnx"),
|
if args.convert_to_tflite:
|
||||||
os.path.join(config["output_dir"], config["model_name"] + ".tflite"))
|
convert_onnx_to_tflite(os.path.join(config["output_dir"], config["model_name"] + ".onnx"),
|
||||||
|
os.path.join(config["output_dir"], config["model_name"] + ".tflite"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue