code: def _argparse_base(
      acqf: MaybeType[AcquisitionFunction],
      sequential: bool = True,
      num_restarts: int = 20,
      raw_samples: int = 1024,
      init_batch_limit: int = 32,
      batch_limit: int = 5,
      optimizer_options: Optional[Dict[str, Any]] = None,
      optimizer_is_discrete: bool = False,
      **ignore: Any,
  ) -> Dict[str, Any]:
      """Extract the base optimizer kwargs form the given arguments.
  
      NOTE: Since `optimizer_options` is how the user would typically pass in these
      options, it takes precedence over other arguments. E.g., if both `num_restarts`
      and `optimizer_options["num_restarts"]` are provided, this will use
      `num_restarts` from `optimizer_options`.
  
      Args:
          acqf: The acquisition function being optimized.
          sequential: Whether we choose one candidate at a time in a sequential manner.
          num_restarts: The number of starting points for multistart acquisition
              function optimization.
          raw_samples: The number of samples for initialization.
          init_batch_limit: The size of mini-batches used to evaluate the `raw_samples`.
              This helps reduce peak memory usage.
          batch_limit: The size of mini-batches used while optimizing the `acqf`.
              This helps reduce peak memory usage.
          optimizer_options: An optional dictionary of optimizer options. This may
              include overrides for the above options (some of these under an `options`
              dictionary) or any other option that is accepted by the optimizer. See
              the docstrings in `botorch/optim/optimize.py` for supported options.
              Example:
                  >>> optimizer_options = {
                  >>>     "num_restarts": 20,
                  >>>     "options": {
                  >>>         "maxiter": 200,
                  >>>         "batch_limit": 5,
                  >>>     },
                  >>>     "retry_on_optimization_warning": False,
                  >>> }
          optimizer_is_discrete: True if the optimizer is `optimizer_acqf_discrete`,
              which supports a limited set of arguments.
      """
      optimizer_options = optimizer_options or {}
      if optimizer_is_discrete:
          return optimizer_options
      return {
          "sequential": sequential,
          "num_restarts": num_restarts,
          "raw_samples": raw_samples,
          "options": {
              "init_batch_limit": init_batch_limit,
              "batch_limit": batch_limit,
              **optimizer_options.get("options", {}),
          },
          **{
              k: v
              for k, v in optimizer_options.items()
              if k != "options"
          },
      }
  
file_path: Ax/ax/models/torch/botorch_modular/optimizer_argparse.py
imports: from __future__ import annotations
  from typing import Any, Dict, Optional, Type, TypeVar, Union
  import torch
  from ax.utils.common.constants import Keys
  from ax.utils.common.typeutils import _argparse_type_encoder
  from botorch.acquisition.acquisition import AcquisitionFunction
  from botorch.acquisition.knowledge_gradient import qKnowledgeGradient
  from botorch.acquisition.max_value_entropy_search import qMaxValueEntropy
  from botorch.acquisition.multi_objective.monte_carlo import qExpectedHypervolumeImprovement
  from botorch.optim.initializers import gen_one_shot_kg_initial_conditions
  from botorch.utils.dispatcher import Dispatcher
label_desc: Use image node_id 1 for calling a global function with example usage: _argparse_base(acqf, sequential, num_restarts, raw_samples, init_batch_limit, batch_limit, optimizer_options, optimizer_is_discrete) and returns: dict, optimizer_options