code: def check_llm_finetuning_backend_config(
      config: "ModelConfig",
  ):  # noqa: F821
      """Checks that the LLM finetuning using Ray is configured correctly.
  
      DDP strategy is not supported for LLM finetuning because it leads to OOMs since the model is large and DDP strategy
      requires a copy of the model on each GPU.
      """
      if config.model_type != MODEL_LLM:
          return
  
      # LLM finetuning is only supported by the finetune trainer type
      if (
          config.trainer.type != "finetune"
          and config.adapter is not None
          and config.adapter.pretrained_adapter_weights is not None
      ):
          return
  
      # Using local backend, so skip the checks below
      if not hasattr(config.backend, "type"):
          return
  
      backend = config.backend
      if (
          not hasattr(backend.trainer, "strategy")
          or backend.trainer.strategy != "deepspeed"
      ):
          raise ConfigValidationError(
              "LLM finetuning with Ray requires the DeepSpeed strategy."
          )
  
      # Deepspeed requires GPU
      if (
          not backend.trainer.use_gpu
          or backend.trainer.resources_per_worker.GPU < 1
      ):
          raise ConfigValidationError(
              "LLM finetuning with DeepSpeed requires GPU."
          )
  
imports: from abc import ABC, abstractmethod
  from re import findall
  from typing import Callable, TYPE_CHECKING
  from transformers import AutoConfig
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import AUDIO, BINARY, CATEGORY, IMAGE, IN_MEMORY, MIN_QUANTIZATION_BITS_FOR_MERGE_AND_UNLOAD, MODEL_ECD, MODEL_GBM, MODEL_LLM, NUMBER, SEQUENCE, SET, TEXT, TIMESERIES, VECTOR
  from ludwig.error import ConfigValidationError
  from ludwig.utils.metric_utils import get_feature_to_metric_names_map_from_feature_collection
  from ludwig.utils.misc_utils import merge_dict
label_desc: Use image node_id 27 for calling a global function with example usage: check_llm_finetuning_backend_config(config) without return types