class_docstr: Generate algorithms for the NNI to automate hyperparameter tuning. The module has two major interfaces:
  ``__init__`` which prints out how to set up the NNI, and a trialCommand function ``run_algo`` for the NNI library to
  start the trial of the algo. More about trialCommand function can be found in ``trail code`` section in NNI webpage
  https://nni.readthedocs.io/en/latest/tutorials/hpo_quickstart_pytorch/main.html .
  
  Args:
      algo: an Algo object (e.g. BundleAlgo) with defined methods: ``get_output_path`` and train
          and supports saving to and loading from pickle files via ``algo_from_pickle`` and ``algo_to_pickle``.
      params: a set of parameter to override the algo if override is supported by Algo subclass.
  
  Examples::
  
      The experiment will keep generating new folders to save the model checkpoints, scripts, and configs if available.
      ├── algorithm_templates
      │   └── unet
      ├── unet_0
      │   ├── algo_object.pkl
      │   ├── configs
      │   └── scripts
      ├── unet_0_learning_rate_0.01
      │   ├── algo_object.pkl
      │   ├── configs
      │   ├── model_fold0
      │   └── scripts
      └── unet_0_learning_rate_0.1
          ├── algo_object.pkl
          ├── configs
          ├── model_fold0
          └── scripts
  
      .. code-block:: python
          # Bundle Algorithms are already generated by BundleGen in work_dir
          import_bundle_algo_history(work_dir, only_trained=False)
          algo_dict = self.history[0]  # pick the first algorithm
          algo_name = algo_dict[AlgoKeys.ID]
          onealgo = algo_dict[AlgoKeys.ALGO]
          nni_gen = NNIGen(algo=onealgo)
          nni_gen.print_bundle_algo_instruction()
  
  Notes:
      The NNIGen will prepare the algorithms in a folder and suggest a command to replace trialCommand in the experiment
      config. However, NNIGen will not trigger NNI. User needs to write their NNI experiment configs, and then run the
      NNI command manually.
docstr: Get parameter for next round of training from NNI server.
docstr_tok: ["Get","parameter","for","next","round","of","training","from","NNI","server","."]
code: def get_hyperparameters(self):
      """
      Get parameter for next round of training from NNI server.
      """
      if has_nni:
          return nni.get_next_parameter()
      warn(
          "NNI is not detected. The code will continue to run without NNI."
      )
      return {}
  
imports: from __future__ import annotations
  import os
  from abc import abstractmethod
  from copy import deepcopy
  from typing import Any, cast
  from warnings import warn
  from monai.apps.auto3dseg.bundle_gen import BundleAlgo
  from monai.apps.utils import get_logger
  from monai.auto3dseg import Algo, AlgoGen, algo_from_pickle, algo_to_pickle
  from monai.bundle.config_parser import ConfigParser
  from monai.config import PathLike
  from monai.utils import optional_import
  from monai.utils.enums import AlgoKeys
label_desc: Use image node_id 4 for calling the NNIGen obj's underlying member method code with example usage: obj.get_hyperparameters() and returns: dict, nni