code: def test_load_checkpoint_model_optimizer_from_raw_checkpoint(
      tmp_path,
  ):
      """Test that the `load_checkpoint` can load raw state dict checkpoints too."""
      strategy = (
          SingleDeviceStrategy()
      )  # surrogate class to test implementation in base class
  
      model = torch.nn.Linear(3, 3)
      optimizer = torch.optim.Adam(model.parameters(), lr=1.0)
      torch.save(model.state_dict(), tmp_path / "model.ckpt")
      torch.save(optimizer.state_dict(), tmp_path / "optimizer.ckpt")
  
      new_model = torch.nn.Linear(3, 3)
      new_optimizer = torch.optim.Adam(new_model.parameters(), lr=2.0)
  
      strategy.load_checkpoint(
          tmp_path / "model.ckpt", state=new_model, strict=False
      )
      assert torch.equal(new_model.weight, model.weight)
      strategy.load_checkpoint(
          tmp_path / "optimizer.ckpt", state=new_optimizer, strict=False
      )
      assert new_optimizer.state_dict()["param_groups"][0]["lr"] == 1.0
  
imports: from unittest import mock
  from unittest.mock import Mock, PropertyMock
  import pytest
  import torch
  from lightning.fabric.plugins import DoublePrecision, HalfPrecision, Precision
  from lightning.fabric.strategies import SingleDeviceStrategy
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_0
  from lightning.fabric.utilities.types import _Stateful
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 6 for calling a global function with example usage: test_load_checkpoint_model_optimizer_from_raw_checkpoint(tmp_path) without return types