code: def test_load_from_checkpoint_warn_on_empty_state_dict(tmp_path):
      """Test that checkpoints can be loaded with an empty state dict and that the appropriate warning is raised."""
      create_boring_checkpoint(
          tmp_path, BoringModel(), accelerator="cpu"
      )
      # Now edit so the state_dict is empty
      checkpoint = torch.load(tmp_path / "checkpoint.ckpt")
      checkpoint["state_dict"] = {}
      torch.save(checkpoint, tmp_path / "checkpoint.ckpt")
  
      with pytest.warns(UserWarning, match="contains no parameters"):
          model = BoringModel.load_from_checkpoint(
              tmp_path / "checkpoint.ckpt", strict=False
          )
      assert model.device.type == "cpu"
  
file_path: pytorch-lightning/tests/tests_pytorch/core/test_saving.py
imports: import lightning.pytorch
  import pytest
  import torch
  from lightning.pytorch.callbacks import ModelCheckpoint
  from lightning.pytorch.demos.boring_classes import BoringDataModule, BoringModel
  from tests_pytorch.conftest import mock_cuda_count, mock_mps_count
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 8 for calling a global function with example usage: test_load_from_checkpoint_warn_on_empty_state_dict(tmp_path) without return types