code: def call_module(module, args=None, kwargs=None):
      if args is None:
          args = ()
      if kwargs is None:
          kwargs = {}
      if isinstance(module, CheckpointModule):
          forward_func = module._forward
      else:
          forward_func = module.forward
      sig = inspect.signature(forward_func)
      param_nums = len(sig.parameters)
      len(args) + len(kwargs)
      args_needed_nums = param_nums - len(kwargs)
      args_needed = args[:args_needed_nums]
      if isinstance(module, CheckpointModule):
          convert_kwargs_to_args = []
          for v in kwargs.values():
              convert_kwargs_to_args.append(v)
          return module(*args_needed, *convert_kwargs_to_args)
      else:
          return module(*args_needed, **kwargs)
  
file_path: ColossalAI/colossalai/legacy/pipeline/utils.py
imports: import heapq
  import inspect
  from collections import OrderedDict
  from typing import List
  import torch
  from colossalai.legacy.nn.layer.utils import CheckpointModule
  from colossalai.logging import get_dist_logger
label_desc: Use image node_id 11 for calling a global function with example usage: call_module(module, args, kwargs) and returns: module, module