class_docstr: A custom model handler implementation.
class_docstr_tok: ["A","custom","model","handler","implementation","."]
docstr: Invoke by torchserve for loading a model
  :param context: context contains model server system properties
  :return:
docstr_tok: ["Invoke","by","torchserve","for","loading","a","model",":","param","context",":","context","contains","model","server","system","properties",":","return",":"]
code: def initialize(self, context):
      """
      Invoke by torchserve for loading a model
      :param context: context contains model server system properties
      :return:
      """
  
      #  load the model
      self.manifest = context.manifest
  
      properties = context.system_properties
      model_dir = properties.get("model_dir")
      self.device = torch.device(
          "cuda:" + str(properties.get("gpu_id"))
          if torch.cuda.is_available()
          else "cpu"
      )
  
      # Read model serialize/pt file
      serialized_file = self.manifest["model"]["serializedFile"]
      model_pt_path = os.path.join(model_dir, serialized_file)
      if not os.path.isfile(model_pt_path):
          raise RuntimeError("Missing the model.pt file")
  
      self.model = torch.jit.load(model_pt_path)
  
      self.initialized = True
  
file_path: serve/examples/asr_rnnt_emformer/handler.py
imports: import json
  import os
  import tempfile
  import torch
  import torchaudio
  from torchaudio.pipelines import EMFORMER_RNNT_BASE_LIBRISPEECH
label_desc: Use image node_id 2 for calling the ModelHandler obj's underlying member method code with example usage: obj.initialize(context) without return types