code: def main():
      # Required arguments
      parser = ArgumentParser()
      parser.add_argument(
          "-model", help="Path to model.", required=True, type=str
      )
      parser.add_argument(
          "-model_task",
          help="Model task.",
          required=True,
          type=str,
          choices=["lm", "seq2seq"],
      )
      parser.add_argument(
          "-inference_config_file",
          help="Inference config file",
          required=True,
          type=str,
      )
      parser.add_argument(
          "-inference_mode",
          help="Inference mode",
          required=True,
          type=str,
          choices=["py", "ct2"],
      )
      parser.add_argument(
          "-input_file",
          help="File with formatted input examples.",
          required=True,
          type=str,
      )
      parser.add_argument(
          "-out",
          help="Output filename.",
          required=True,
          type=str,
      )
      args = parser.parse_args()
      model = args.model
      inference_config_file = args.inference_config_file
      base_args = ["-config", inference_config_file]
      parser = _get_parser()
      opt = parser.parse_args(base_args)
      ArgumentParser.validate_translate_opts(opt)
      ArgumentParser._get_all_transform_translate(opt)
      ArgumentParser._validate_transforms_opts(opt)
      ArgumentParser.validate_translate_opts_dynamic(opt)
      set_random_seed(opt.seed, use_gpu(opt))
      opt.models = [model]
      opt.model_task = args.model_task
  
      evaluate(
          opt,
          inference_mode=args.inference_mode,
          input_file=args.input_file,
          out=args.out,
          method="file",
      )
      evaluate(
          opt,
          inference_mode=args.inference_mode,
          input_file=args.input_file,
          out=args.out,
          method="list",
      )
  
file_path: OpenNMT-py/onmt/tests/test_inference_engines.py
imports: import json
  import time
  import onmt.opts
  from onmt.utils.parse import ArgumentParser
  from onmt.utils.misc import use_gpu, set_random_seed
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types