code: def test_model_saving_loading(tmpdir):
      """Tests use case where trainer saves the model, and user loads it from tags independently."""
      model = BoringModel()
  
      # logger file to get meta
      logger = tutils.get_default_logger(tmpdir)
  
      # fit model
      trainer = Trainer(
          max_epochs=1,
          limit_train_batches=2,
          limit_val_batches=2,
          logger=logger,
          callbacks=[ModelCheckpoint(dirpath=tmpdir)],
          default_root_dir=tmpdir,
      )
      trainer.fit(model)
  
      # make a prediction
      dataloaders = model.test_dataloader()
      batch = next(iter(dataloaders))
  
      # generate preds before saving model
      model.eval()
      pred_before_saving = model(batch)
  
      # save model
      new_weights_path = os.path.join(tmpdir, "save_test.ckpt")
      trainer.save_checkpoint(new_weights_path)
  
      # load new model
      hparams_path = tutils.get_data_path(logger, path_dir=tmpdir)
      hparams_path = os.path.join(hparams_path, "hparams.yaml")
      model_2 = BoringModel.load_from_checkpoint(
          checkpoint_path=new_weights_path, hparams_file=hparams_path
      )
      model_2.eval()
  
      # make prediction
      # assert that both predictions are the same
      new_pred = model_2(batch)
      assert (
          torch.all(torch.eq(pred_before_saving, new_pred)).item() == 1
      )
  
imports: import glob
  import logging
  import os
  import pickle
  from copy import deepcopy
  from typing import Generic, Mapping, TypeVar
  import cloudpickle
  import pytest
  import torch
  from lightning.fabric import seed_everything
  from lightning.pytorch import Callback, Trainer
  from lightning.pytorch.callbacks import ModelCheckpoint
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.trainer.states import TrainerFn
  from lightning_utilities.test.warning import no_warning_call
  from torch import Tensor
  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
  from tests_pytorch.loops.test_loops import CustomException
label_desc: Use image node_id 11 for calling a global function with example usage: test_model_saving_loading(tmpdir) without return types