code: def test_deprecated_hyperopt_sampler_early_stopping(use_scheduler):
      sampler = {
          "type": "ray",
          "num_samples": 2,
      }
  
      if use_scheduler:
          sampler[SCHEDULER] = {
              "type": "async_hyperband",
              "max_t": 200,
              "time_attr": "time_total_s",
              "grace_period": 72,
              "reduction_factor": 5,
          }
  
      config = {
          INPUT_FEATURES: [
              {
                  "type": "category",
                  "name": "cat_input_feature",
              },
          ],
          OUTPUT_FEATURES: [
              {
                  "type": "number",
                  "name": "num_output_feature",
              },
          ],
          "hyperopt": {
              "search_alg": {
                  "type": "hyperopt",
                  "random_state_seed": 42,
              },
              "executor": {
                  "type": "ray",
                  "time_budget_s": 200,
                  "cpu_resources_per_trial": 1,
              },
              "sampler": sampler,
              "parameters": {
                  "trainer.batch_size": {
                      "space": "choice",
                      "categories": [64, 128, 256],
                  },
                  "trainer.learning_rate": {
                      "space": "loguniform",
                      "lower": 0.001,
                      "upper": 0.1,
                  },
              },
          },
      }
  
      updated_config = upgrade_config_dict_to_latest_version(config)
      if use_scheduler:
          assert SCHEDULER in updated_config[HYPEROPT][EXECUTOR]
  
      merged_config = ModelConfig.from_dict(updated_config).to_dict()
  
      # When a scheulder is provided, early stopping in the rendered config needs to be disabled to allow the
      # hyperopt scheduler to manage trial lifecycle.
      expected_early_stop = (
          -1 if use_scheduler else ECDTrainerConfig().early_stop
      )
      assert merged_config[TRAINER]["early_stop"] == expected_early_stop
  
imports: import copy
  import math
  from typing import Any, Dict
  import pytest
  from ludwig.constants import BATCH_SIZE, BFILL, CLASS_WEIGHTS, DEFAULTS, EVAL_BATCH_SIZE, EXECUTOR, HYPEROPT, INPUT_FEATURES, LEARNING_RATE_SCHEDULER, LOSS, NUMBER, OUTPUT_FEATURES, PREPROCESSING, SCHEDULER, SPLIT, TRAINER, TYPE
  from ludwig.schema.model_config import ModelConfig
  from ludwig.schema.trainer import ECDTrainerConfig
  from ludwig.utils.backward_compatibility import _update_backend_cache_credentials, _upgrade_encoder_decoder_params, _upgrade_feature, _upgrade_preprocessing_split, upgrade_config_dict_to_latest_version, upgrade_missing_value_strategy, upgrade_model_progress
  from ludwig.utils.trainer_utils import TrainerMetric
label_desc: Use image node_id 6 for calling a global function with example usage: test_deprecated_hyperopt_sampler_early_stopping(use_scheduler) without return types