code: def test_trainer_model_hook_system_predict(tmpdir):
      called = []
      model = HookedModel(called)
      callback = HookedCallback(called)
      batches = 2
      trainer = Trainer(
          default_root_dir=tmpdir,
          limit_predict_batches=batches,
          enable_progress_bar=False,
          callbacks=[callback],
      )
      trainer.predict(model)
      expected = [
          {"name": "configure_callbacks"},
          {"name": "prepare_data"},
          {
              "name": "Callback.setup",
              "args": (trainer, model),
              "kwargs": {"stage": "predict"},
          },
          {"name": "setup", "kwargs": {"stage": "predict"}},
          {"name": "configure_model"},
          {
              "name": "zero_grad",
              **(
                  {}
                  if _TORCH_GREATER_EQUAL_2_0
                  else {"kwargs": {"set_to_none": True}}
              ),
          },
          {"name": "predict_dataloader"},
          {"name": "train", "args": (False,)},
          {"name": "on_predict_model_eval"},
          {
              "name": "Callback.on_predict_start",
              "args": (trainer, model),
          },
          {"name": "on_predict_start"},
          {
              "name": "Callback.on_predict_epoch_start",
              "args": (trainer, model),
          },
          {"name": "on_predict_epoch_start"},
          *model._predict_batch(
              trainer, model, batches, trainer.strategy.root_device
          ),
          {
              "name": "Callback.on_predict_epoch_end",
              "args": (trainer, model),
          },
          {"name": "on_predict_epoch_end"},
          {"name": "Callback.on_predict_end", "args": (trainer, model)},
          {"name": "on_predict_end"},
          # TODO: `on_predict_model_train`
          {
              "name": "Callback.teardown",
              "args": (trainer, model),
              "kwargs": {"stage": "predict"},
          },
          {"name": "teardown", "kwargs": {"stage": "predict"}},
      ]
      assert called == expected
  
imports: from functools import partial, update_wrapper
  from inspect import getmembers, isfunction
  from unittest import mock
  from unittest.mock import ANY, PropertyMock
  import pytest
  import torch
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_0
  from lightning.pytorch import Callback, LightningDataModule, LightningModule, Trainer, __version__
  from lightning.pytorch.demos.boring_classes import BoringDataModule, BoringModel, RandomDataset
  from lightning.pytorch.utilities.model_helpers import is_overridden
  from torch import Tensor
  from torch.utils.data import DataLoader
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 10 for calling a global function with example usage: test_trainer_model_hook_system_predict(tmpdir) without return types