code: def test_raises_when_accumulate_grad_batches_with_callback(tmp_path):
      """Test that it is not allowed to set both the Trainer argument and also pass a callback."""
      trainer = Trainer(
          default_root_dir=tmp_path,
          accumulate_grad_batches=2,
          callbacks=[GradientAccumulationScheduler({0: 2})],
      )
      with pytest.raises(
          ValueError,
          match="`accumulate_grad_batches` and are using the `GradientAccumulationScheduler`",
      ):
          trainer.fit(BoringModel())
  
file_path: pytorch-lightning/tests/tests_pytorch/callbacks/test_gradient_accumulation_scheduler.py
imports: import math
  from unittest.mock import Mock, patch
  import pytest
  from lightning.pytorch import Trainer
  from lightning.pytorch.callbacks import GradientAccumulationScheduler
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.strategies import DeepSpeedStrategy
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.imports import _LIGHTNING_COLOSSALAI_AVAILABLE
label_desc: Use image node_id 8 for calling a global function with example usage: test_raises_when_accumulate_grad_batches_with_callback(tmp_path) without return types