code: def test_deepspeed_save_checkpoint_warn_colliding_keys(tmp_path):
      """Test that the strategy warns if there are keys in the user dict that collide internally with DeepSpeed."""
      from deepspeed import DeepSpeedEngine
  
      strategy = DeepSpeedStrategy()
      optimizer = Mock()
      model = Mock(spec=DeepSpeedEngine, optimizer=optimizer)
      model.modules.return_value = [model]
      # `mp_world_size` is an internal key
      with pytest.warns(
          UserWarning,
          match="Your state has keys that collide with DeepSpeed's internal",
      ):
          strategy.save_checkpoint(
              path=tmp_path,
              state={
                  "model": model,
                  "optimizer": optimizer,
                  "mp_world_size": 2,
              },
          )
  
imports: import json
  from re import escape
  from unittest import mock
  from unittest.mock import ANY, Mock
  import pytest
  import torch
  from lightning.fabric.accelerators import CPUAccelerator, CUDAAccelerator
  from lightning.fabric.strategies import DeepSpeedStrategy
  from torch.optim import Optimizer
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 14 for calling a global function with example usage: test_deepspeed_save_checkpoint_warn_colliding_keys(tmp_path) without return types