code: def reduce_text_feature_max_length(
      config, training_set_metadata
  ) -> bool:
      """Reduce max sequence length, when viable, to control its quadratic impact."""
      input_features = config["input_features"]
      min_usable_length = _get_text_feature_min_usable_length(
          input_features, training_set_metadata
      )
      seq_len_limit = {"max_sequence_length": min_usable_length}
      if "preprocessing" not in config:
          config["preprocessing"] = {TEXT: seq_len_limit}
      elif (
          (TEXT not in config["preprocessing"])
          or (
              "max_sequence_length" not in config["preprocessing"][TEXT]
          )
          or (
              min_usable_length
              < float(
                  config["preprocessing"][TEXT]["max_sequence_length"]
              )
          )
      ):
          config["preprocessing"][TEXT] = seq_len_limit
      else:
          return False
      return True
  
imports: import copy
  import logging
  import math
  from collections import OrderedDict
  from typing import List
  import psutil
  from ludwig.api import LudwigModel
  from ludwig.backend import initialize_backend
  from ludwig.constants import AUTO, AUTOML_DEFAULT_TEXT_ENCODER, AUTOML_LARGE_TEXT_DATASET, AUTOML_MAX_ROWS_PER_CHECKPOINT, AUTOML_SMALLER_TEXT_ENCODER, AUTOML_SMALLER_TEXT_LENGTH, AUTOML_TEXT_ENCODER_MAX_TOKEN_LEN, HYPEROPT, MINIMUM_BATCH_SIZE, PREPROCESSING, SPACE, TEXT, TRAINER
  from ludwig.data.preprocessing import preprocess_for_training
  from ludwig.features.feature_registries import update_config_with_metadata
  from ludwig.schema.model_config import ModelConfig
  from ludwig.utils.automl.utils import get_model_type
  from ludwig.utils.torch_utils import initialize_pytorch
label_desc: Use image node_id 10 for calling a global function with example usage: reduce_text_feature_max_length(config, training_set_metadata) and returns: True, False