code: def test_grad_clipping_lm_fabric(algo):
      from lightning.pytorch.utilities import GradClipAlgorithmType
  
      class DummyLM(LightningModule):
          def __init__(self):
              super().__init__()
              self.model = nn.Linear(1, 1)
  
      fabric = Fabric()
      orig_model = DummyLM()
      model = fabric.setup(orig_model)
  
      fabric.clip_gradients = Mock()
  
      optimizer = Mock()
      model.clip_gradients(
          optimizer,
          gradient_clip_val=1e-3,
          gradient_clip_algorithm=GradClipAlgorithmType(algo),
      )
  
      if algo == "value":
          fabric.clip_gradients.assert_called_once_with(
              orig_model, optimizer, clip_val=1e-3, max_norm=None
          )
      else:
          fabric.clip_gradients.assert_called_once_with(
              orig_model, optimizer, clip_val=None, max_norm=1e-3
          )
  
imports: import sys
  import weakref
  from unittest.mock import Mock
  import pytest
  import torch
  from lightning.fabric import Fabric
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_1_13, _TORCH_GREATER_EQUAL_2_0
  from lightning.pytorch import LightningModule, Trainer
  from lightning.pytorch.core.module import _TrainerFabricShim
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.loggers import TensorBoardLogger
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from torch import nn
  from torch.optim import SGD, Adam
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 23 for calling a global function with example usage: test_grad_clipping_lm_fabric(algo) without return types