code: def call_sockeye_translate(args: List[str],
                             input_fname: str,
                             output_fname: str,
                             model_dir: str,
                             log_fname: str,
                             use_cpu: bool):
      
      # Inputs and outputs
      fnames = ["--input={}".format(input_fname),
                "--output={}".format(output_fname),
                "--models={}".format(model_dir)]
      # Assemble command
      command = [sys.executable, "-m", "sockeye.translate"] + fnames + args
      # Request GPUs or specify CPU
      if use_cpu:
          command.append("--use-cpu")
      command_fname = output_fname + "." + SUFFIX_COMMAND
      # Run unless translate already finished
      if not os.path.exists(command_fname):
          # Call Sockeye translate
          with open(log_fname, "wb") as log:
              logging.info("sockeye.translate: %s -> %s", input_fname, output_fname)
              logging.info("Log: %s", log_fname)
              subprocess.check_call(command, stderr=log)
          # Cleanup redundant log file
          try:
              os.remove(output_fname + ".log")
          except FileNotFoundError:
              pass
  
          # Record successful command
          logging.info("Command: %s", command_fname)
          print_command(command, command_fname)
docs: Call sockeye.translate with specified arguments using a trained model.
  
      :param args: Command line arguments for sockeye.translate.
      :param input_fname: Input file (byte-pair encoded).
      :param output_fname: Raw decoder output file.
      :param model_dir: Model output directory.
      :param log_fname: Location to write log file.
      :param use_cpu: Use CPU instead of GPU for decoding.