class_docstr: INC Custom strategy definition
class_docstr_tok: ["INC","Custom","strategy","definition"]
code: def bayesian_configurations(self, cfg_base, params_base):
      from neural_compressor.strategy.bayesian import (
          BayesianOptimization,
      )
  
      # For each node we specify the possible range of values (we treat them as a configurations' index)
      pbounds = {}
      for node_key, configs in self.opwise_quant_cfgs.items():
          if node_key in params_base and len(configs) > 1:
              pbounds[node_key] = (0, len(configs))
  
      cfg = copy.deepcopy(cfg_base)
      if (
          len(pbounds) == 0
      ):  # if there is nothing to be optimized, we finish
          cfg["op"].update(
              self.bayesian_params_to_tune_configs(params_base)
          )
          return
  
      bayes_opt = BayesianOptimization(
          pbounds=pbounds, random_seed=self.cfg.tuning.random_seed
      )
      bayes_opt._space.register(
          params_base, self.last_tune_result[0]
      )  # registering the outcome of current configuration
      while True:
          # Generating next configuration
          params = bayes_opt.gen_next_params()
          cfg["op"].update(self.bayesian_params_to_tune_configs(params))
          yield cfg
          try:
              # Registering the outcome
              bayes_opt._space.register(
                  params, self.last_tune_result[0]
              )
          except KeyError:
              pass
  
file_path: gluon-nlp/scripts/question_answering/custom_strategy.py
imports: import copy
  import numpy
  from collections import OrderedDict
  from neural_compressor.strategy.strategy import TuneStrategy, strategy_registry
label_desc: Use image node_id 5 for calling the MyCustomTuneStrategy obj's underlying member method code with example usage: obj.bayesian_configurations(cfg_base, params_base) without return types