class_docstr: Parallelization process class
  
  Args:
      model (nn.Module): model weights
      fp16: (bool): whether use FP16 or not.
      rank (int): current GPU rank
      num_gpus (int): number of gpus for parallelization
      inputs_queue (mp.Queue): input data queue from user
      outputs_queue (mp.Queue): output data queue from model
      parallel_mutex (mp.Event): mutex object to notify parallelization state
      inference_mutex (mp.Event): mutex object to notify inference state
      verbose (str): turn on gpu summary
      backend (str): distributed process backend
      custom_policies (Union[Policy, List[Policy]]): user customized policy objects
  
  Notes:
      ParallelProcess object handles below two tasks.
  
      1) Parallelize the model
      2) Handle the inference state
class_docstr_tok: ["Parallelization","process","class","Args",":","model","(","nn.Module",")",":","model","weights","fp16",":","(","bool",")",":","whether","use","FP16","or","not",".","rank","(","int",")",":","current","GPU","rank","num_gpus","(","int",")",":","number","of","gpus","for","parallelization","inputs_queue","(","mp.Queue",")",":","input","data","queue","from","user","outputs_queue","(","mp.Queue",")",":","output","data","queue","from","model","parallel_mutex","(","mp.Event",")",":","mutex","object","to","notify","parallelization","state","inference_mutex","(","mp.Event",")",":","mutex","object","to","notify","inference","state","verbose","(","str",")",":","turn","on","gpu","summary","backend","(","str",")",":","distributed","process","backend","custom_policies","(","Union","[","Policy",",","List","[","Policy","]","]",")",":","user","customized","policy","objects","Notes",":","ParallelProcess","object","handles","below","two","tasks",".","1",")","Parallelize","the","model","2",")","Handle","the","inference","state"]
docstr: Start parallelization process
docstr_tok: ["Start","parallelization","process"]
code: def run(self) -> None:
      """Start parallelization process"""
      engine = ParallelEngine(
          num_gpus=self.num_gpus,
          backend=self.backend,
          custom_policies=self.custom_policies,
      )
  
      try:
          self.model = engine.parallelize(self.model, self.fp16)
          self.parallel_mutex.set()
  
          if self.verbose:
              if (
                  self.verbose is True
                  or self.verbose.lower() == "simple"
              ):
                  device = torch.cuda.current_device()
                  print(
                      f"GPU {device} alloc: {torch.cuda.memory_allocated(device)}"
                  )
                  print(
                      f"GPU {device} cached: {torch.cuda.memory_reserved(device)}"
                  )
                  print()
  
              elif self.verbose.lower() == "detail":
                  print(torch.cuda.memory_summary())
                  print()
  
          self.inference(self.model)
          self.destroy()
  
      except BaseException:
          traceback.print_exc()
          self.destroy()
  
imports: import copyreg
  import io
  import os
  import pickle
  import random
  import traceback
  import types
  from contextlib import suppress
  from dataclasses import _is_dataclass_instance, asdict
  from inspect import signature
  from time import time
  from typing import Any, List, Union
  import numpy
  import torch
  import torch.distributed
  import torch.multiprocessing
  import torch.nn
  from transformers.file_utils import ModelOutput
  from parallelformers.parallel.engine import ParallelEngine
  from parallelformers.policies.base import Policy
label_desc: Use image node_id 6 for calling the ParallelProcess obj's underlying member method code with example usage: obj.run() without return types