code: def test_cpu_slurm_save_load(_, tmpdir):
      """Verify model save/load/checkpoint on CPU."""
      seed_everything(42)
  
      model = BoringModel()
  
      # logger file to get meta
      logger = tutils.get_default_logger(tmpdir)
      version = logger.version
  
      # fit model
      trainer = Trainer(
          default_root_dir=tmpdir,
          max_epochs=1,
          logger=logger,
          limit_train_batches=0.2,
          limit_val_batches=0.2,
          callbacks=[ModelCheckpoint(dirpath=tmpdir)],
      )
      trainer.fit(model)
      real_global_step = trainer.global_step
  
      # traning complete
      assert trainer.state.finished, "cpu model failed to complete"
  
      # predict with trained model before saving
      # make a prediction
      dataloaders = model.test_dataloader()
      if not isinstance(dataloaders, list):
          dataloaders = [dataloaders]
  
      for dataloader in dataloaders:
          for batch in dataloader:
              break
  
      model.eval()
      pred_before_saving = model(batch)
  
      # test HPC saving
      # simulate snapshot on slurm
      # save logger to make sure we get all the metrics
      if logger:
          logger.finalize("finished")
      hpc_save_path = trainer._checkpoint_connector.hpc_save_path(
          trainer.default_root_dir
      )
      trainer.save_checkpoint(hpc_save_path)
      assert os.path.exists(hpc_save_path)
  
      # new logger file to get meta
      logger = tutils.get_default_logger(tmpdir, version=version)
  
      model = BoringModel()
  
      class _StartCallback(Callback):
          # set the epoch start hook so we can predict before the model does the full training
          def on_train_epoch_start(self, trainer, model):
              assert trainer.global_step == real_global_step
              assert trainer.global_step > 0
              # predict with loaded model to make sure answers are the same
              mode = model.training
              model.eval()
              new_pred = model(batch)
              assert torch.eq(pred_before_saving, new_pred).all()
              model.train(mode)
  
      trainer = Trainer(
          default_root_dir=tmpdir,
          max_epochs=1,
          logger=logger,
          callbacks=[_StartCallback(), ModelCheckpoint(dirpath=tmpdir)],
      )
      # by calling fit again, we trigger training, loading weights from the cluster
      # and our hook to predict using current model before any more weight updates
      trainer.fit(model)
  
file_path: pytorch-lightning/tests/tests_pytorch/models/test_cpu.py
imports: import os
  from unittest import mock
  import torch
  from lightning.pytorch import Trainer, seed_everything
  from lightning.pytorch.callbacks import Callback, EarlyStopping, ModelCheckpoint
  from lightning.pytorch.demos.boring_classes import BoringModel
  import tests_pytorch.helpers.pipelines
  import tests_pytorch.helpers.utils
  from tests_pytorch.helpers.datamodules import ClassifDataModule
  from tests_pytorch.helpers.runif import RunIf
  from tests_pytorch.helpers.simple_models import ClassificationModel
label_desc: Use image node_id 1 for calling a global function with example usage: test_cpu_slurm_save_load(_, tmpdir) without return types