code: def optimize_models(args, use_cuda, models):
      """Optimize ensemble for generation"""
      for model in models:
          model.make_generation_fast_(
              beamable_mm_beam_size=None
              if args.no_beamable_mm
              else args.beam,
              need_attn=args.print_alignment,
          )
          if args.fp16:
              model.half()
          if use_cuda:
              model.cuda()
  
imports: import ast
  import logging
  import math
  import os
  import sys
  import editdistance
  import numpy
  import torch
  from fairseq import checkpoint_utils, options, progress_bar, tasks, utils
  from fairseq.data.data_utils import post_process
  from fairseq.logging.meters import StopwatchMeter, TimeMeter
label_desc: Use image node_id 6 for calling a global function with example usage: optimize_models(args, use_cuda, models) without return types