code: def model_forward(
      model: Module, data: Any, internal_inputs: Optional[dict]
  ) -> Any:
      """Call model forward function with data and internal inputs.
  
      Args:
          model (Module): Model to be called.
          data (Any): Data loaded from data iterator.
          internal_inputs (Optional[dict]): Data from previous stage. It must be a dict or None if it's the first stage.
  
      Returns:
          Any: Outputs of the model.
      """
      if internal_inputs is None:
          internal_inputs = {}
      if isinstance(data, (list, tuple)):
          return model(*data, **internal_inputs)
      elif isinstance(data, dict):
          return model(**data, **internal_inputs)
      return model(data, **internal_inputs)
  
file_path: colossalai/colossalai/pipeline/schedule/_utils.py
imports: from collections import OrderedDict
  from typing import Any, List, Optional, Tuple
  import torch
  import torch.cuda
  from torch.nn import Module
  from torch.utils._pytree import SUPPORTED_NODES, TreeSpec, _register_pytree_node, tree_flatten, tree_map, tree_unflatten
label_desc: Use image node_id 8 for calling a global function with example usage: model_forward(model, data, internal_inputs) and returns: model, model, model