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: Check object is picklable.
  If it is not picklable, this method will change the dataclass instance to a dictionary.
  It is is not dataclass raise exception.
  
  Args:
      obj (Any): object to check picklable
  
  Returns:
      Any: picklable object
docstr_tok: ["Check","object","is","picklable",".","If","it","is","not","picklable",",","this","method","will","change","the","dataclass","instance","to","a","dictionary",".","It","is","is","not","dataclass","raise","exception",".","Args",":","obj","(","Any",")",":","object","to","check","picklable","Returns",":","Any",":","picklable","object"]
code: def check_picklable(self, obj: Any) -> Any:
      """
      Check object is picklable.
      If it is not picklable, this method will change the dataclass instance to a dictionary.
      It is is not dataclass raise exception.
  
      Args:
          obj (Any): object to check picklable
  
      Returns:
          Any: picklable object
      """
      try:
          pickle.loads(ForkingPickler.dumps(obj).tobytes())
      except BaseException:
          if _is_dataclass_instance(obj) or isinstance(
              obj, ModelOutput
          ):
              _obj = asdict(obj)
              _obj["orig_dataclass_type"] = obj.__class__
              obj = _obj
          else:
              raise Exception(
                  f"Type '{obj.__class__}' can't be pickled. "
                  f"Please check type of model output !"
              )
  
      return obj
  
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 5 for calling the ParallelProcess obj's underlying member method code with example usage: obj.check_picklable(obj) and returns: obj