code: def update_tabular_config_by_resources(
      config: DictConfig,
      num_numerical_columns: Optional[int] = 0,
      num_categorical_columns: Optional[int] = 0,
      resource: Optional[int] = 16,
  ):
      """
      Modify configs based on the dataset statistics.
      Use Additive attention with large column count and tune batch size accordingly.
      Parameters
      ----------
      config
          The config of the project. It is a Dictconfig object.
      num_numerical_columns
          The number of numerical columns.
      num_categorical_columns
          The number of categorical columns.
      resource
          The maximum resource (memory in GB) a single GPU has.
      Returns
      -------
      The modified config.
      """
      columns_per_model = {
          FUSION_TRANSFORMER: num_categorical_columns
          + num_numerical_columns,
          FT_TRANSFORMER: num_categorical_columns
          + num_numerical_columns,
      }
  
      # Threshold is expected to be ~= batch_size * num_tokens, for additive attention.
      # The multiplier 2e4 is a heuristic found from AutoML Benchmark.
      # TODO: determine the threshold/batch_size on training data directly
      threshold = resource * 2e4
      per_gpu_batch_size = config.env.per_gpu_batch_size
      for model in columns_per_model:
          if model in config.model.names:
              model_ = getattr(config.model, model)
              if (
                  columns_per_model[model] > 300
                  and model_.additive_attention == "auto"
              ):
                  model_.additive_attention = True
                  model_.share_qv_weights = (
                      True
                      if model_.share_qv_weights == "auto"
                      else model_.share_qv_weights
                  )
                  warnings.warn(
                      f"Dataset contains >300 features, using additive attention for efficiency",
                      UserWarning,
                  )
                  if (
                      columns_per_model[model] * per_gpu_batch_size
                      > threshold
                  ):
                      per_gpu_batch_size = int(
                          threshold / columns_per_model[model]
                      )
  
              model_.additive_attention = (
                  False
                  if model_.additive_attention == "auto"
                  else model_.additive_attention
              )
              model_.share_qv_weights = (
                  False
                  if model_.share_qv_weights == "auto"
                  else model_.share_qv_weights
              )
  
      per_gpu_batch_size = max(per_gpu_batch_size, 1)
      if per_gpu_batch_size < config.env.per_gpu_batch_size:
          config.env.per_gpu_batch_size = per_gpu_batch_size
          warnings.warn(
              f"Setting  per_gpu_batch_size to {per_gpu_batch_size} to fit into GPU memory",
              UserWarning,
          )
  
      return config
  
imports: import copy
  import logging
  import os
  import re
  import warnings
  from typing import Callable, Dict, List, Optional, Tuple, Union
  from omegaconf import DictConfig, OmegaConf
  from packaging import version
  from torch import nn
  from ..constants import AUTOMM, DATA, FT_TRANSFORMER, FUSION_TRANSFORMER, HF_MODELS, MODEL, REGRESSION, VALID_CONFIG_KEYS
  from ..presets import get_automm_presets, get_basic_automm_config
  from .data import get_detected_data_types
label_desc: Use image node_id 13 for calling a global function with example usage: update_tabular_config_by_resources(config, num_numerical_columns, num_categorical_columns, resource) and returns: config