code: def get_num_duplicate_trials(
      hyperopt_config: HyperoptConfigDict,
  ) -> int:
      """Returns the number of duplicate trials that will be created.
  
      Duplicate trials are only created when there are grid type parameters and num_samples > 1.
      """
      num_samples = hyperopt_config[EXECUTOR].get(NUM_SAMPLES, 1)
      if num_samples == 1:
          return 0
  
      total_grid_search_trials = 1
      for _, param_info in hyperopt_config[PARAMETERS].items():
          if param_info.get(SPACE, None) == GRID_SEARCH:
              total_grid_search_trials *= len(
                  param_info.get("values", [])
              )
  
      num_duplicate_trials = (
          total_grid_search_trials * num_samples
      ) - total_grid_search_trials
      return num_duplicate_trials
  
imports: import copy
  import dataclasses
  import json
  import logging
  import os
  import warnings
  from typing import Any, Dict
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import AUTO, COMBINED, EXECUTOR, GOAL, GRID_SEARCH, HYPEROPT, INPUT_FEATURES, LOSS, MAX_CONCURRENT_TRIALS, METRIC, MINIMIZE, NAME, NUM_SAMPLES, OUTPUT_FEATURES, PARAMETERS, PREPROCESSING, RAY, SPACE, SPLIT, TYPE, VALIDATION
  from ludwig.globals import HYPEROPT_STATISTICS_FILE_NAME
  from ludwig.hyperopt.results import HyperoptResults, TrialResults
  from ludwig.types import HyperoptConfigDict, ModelConfigDict
  from ludwig.utils.data_utils import save_json
  from ludwig.utils.misc_utils import get_class_attributes, get_from_registry, merge_dict, set_default_value, set_default_values
  from ludwig.utils.print_utils import print_boxed
label_desc: Use image node_id 10 for calling a global function with example usage: get_num_duplicate_trials(hyperopt_config) and returns: num_duplicate_trials, int