code: def do_inference(args):
      prepare_output_path(args.output_dir, args.overwrite_output_dir)
      device, n_gpus = setup_backend(args.no_cuda)
      args.task_name = args.task_name.lower()
      task = get_glue_task(args.task_name, data_dir=args.data_dir)
      args.batch_size = args.per_gpu_eval_batch_size * max(1, n_gpus)
      classifier = TransformerSequenceClassifier.load_model(
          model_path=args.model_path,
          model_type=args.model_type,
          task_type=task.task_type,
          metric_fn=get_metric_fn(task.name),
          do_lower_case=args.do_lower_case,
          load_quantized=args.load_quantized_model,
      )
      classifier.to(device, n_gpus)
      examples = (
          task.get_dev_examples()
          if args.evaluate
          else task.get_test_examples()
      )
      preds = classifier.inference(
          examples,
          args.max_seq_length,
          args.batch_size,
          evaluate=args.evaluate,
      )
      with io.open(
          os.path.join(args.output_dir, "output.txt"),
          "w",
          encoding="utf-8",
      ) as fw:
          for p in preds:
              fw.write("{}\n".format(p))
  
imports: import argparse
  import io
  import logging
  import os
  from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
  from nlp_architect.data.glue_tasks import get_glue_task, get_metric_fn, processors
  from nlp_architect.models.transformers import TransformerSequenceClassifier
  from nlp_architect.nn.torch import set_seed, setup_backend
  from nlp_architect.procedures.procedure import Procedure
  from nlp_architect.procedures.registry import register_inference_cmd, register_train_cmd
  from nlp_architect.procedures.transformers.base import create_base_args, inference_args, train_args
  from nlp_architect.utils.io import prepare_output_path
label_desc: Use image node_id 4 for calling a global function with example usage: do_inference(args) without return types