code: def initialize(self, ctx):
      properties = ctx.system_properties
      self.device = "cpu"
      if (
          torch.cuda.is_available()
          and properties.get("gpu_id") is not None
      ):
          self.map_location = "cuda"
          self.device = torch.device(
              self.map_location + ":" + str(properties.get("gpu_id"))
          )
          torch.cuda.set_device(self.device)
  
      model_type = ctx.model_yaml_config["handler"]["model_type"]
      sam_checkpoint = ctx.model_yaml_config["handler"][
          "sam_checkpoint"
      ]
      process_batch_size = ctx.model_yaml_config["handler"][
          "process_batch_size"
      ]
  
      self.model = sam_model_fast_registry[model_type](
          checkpoint=sam_checkpoint
      )
      self.model.to(self.device)
  
      self.mask_generator = SamAutomaticMaskGenerator(
          self.model,
          process_batch_size=process_batch_size,
          output_mode="coco_rle",
      )
  
      logger.info(
          f"Model weights {sam_checkpoint} for {model_type} loaded successfully with process batch size {process_batch_size}"
      )
      self.initialized = True
  
file_path: serve/examples/large_models/segment_anything_fast/custom_handler.py
imports: import base64
  import io
  import logging
  import pickle
  import cv2
  import numpy
  import torch
  from PIL import Image
  from segment_anything_fast import SamAutomaticMaskGenerator, sam_model_fast_registry
  from ts.handler_utils.timer import timed
  from ts.torch_handler.base_handler import BaseHandler
label_desc: Use image node_id 2 for calling the SegmentAnythingFastHandler obj's underlying member method code with example usage: obj.initialize(ctx) without return types