m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.1 KiB

7 months ago
  1. #!/usr/bin/env python3
  2. # Copyright (c) Microsoft Corporation. All rights reserved.
  3. # Licensed under the MIT License.
  4. import argparse
  5. import os
  6. import pathlib
  7. from .onnx_model_utils import update_onnx_opset
  8. def update_onnx_opset_helper():
  9. parser = argparse.ArgumentParser(
  10. f"{os.path.basename(__file__)}:{update_onnx_opset_helper.__name__}",
  11. description="""
  12. Update the ONNX opset of the model.
  13. New opset must be later than the existing one.
  14. If not specified will update to opset 15.
  15. """,
  16. )
  17. parser.add_argument("--opset", type=int, required=False, default=15, help="ONNX opset to update to.")
  18. parser.add_argument("input_model", type=pathlib.Path, help="Provide path to ONNX model to update.")
  19. parser.add_argument("output_model", type=pathlib.Path, help="Provide path to write updated ONNX model to.")
  20. args = parser.parse_args()
  21. update_onnx_opset(args.input_model, args.opset, args.output_model)
  22. if __name__ == "__main__":
  23. update_onnx_opset_helper()