class_docstr: Generate algorithms for the Optuna to automate hyperparameter tuning. Please refer to NNI and Optuna
  (https://optuna.readthedocs.io/en/stable/) for more information. Optuna has different running scheme
  compared to NNI. The hyperparameter samples come from a trial object (trial.suggest...) created by Optuna,
  so OptunaGen needs to accept this trial object as input. Meanwhile, Optuna calls OptunaGen,
  thus OptunaGen.__call__() should return the accuracy. Use functools.partial to wrap OptunaGen
  for addition input arguments.
  
  Args:
      algo: an Algo object (e.g. BundleAlgo). The object must at least define two 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
  
  Notes:
      Different from NNI and NNIGen, OptunaGen and Optuna can be ran within the Python process.
docstr: Callable that Optuna will use to optimize the hyper-parameters
  
  Args:
      obj_filename: the pickle-exported Algo object.
      output_folder: the root path of the algorithms templates.
      template_path: the algorithm_template. It must contain algo.py in the follow path:
          ``{algorithm_templates_dir}/{network}/scripts/algo.py``
docstr_tok: ["Callable","that","Optuna","will","use","to","optimize","the","hyper-parameters","Args",":","obj_filename",":","the","pickle-exported","Algo","object",".","output_folder",":","the","root","path","of","the","algorithms","templates",".","template_path",":","the","algorithm_template",".","It","must","contain","algo.py","in","the","follow","path",":","``","{","algorithm_templates_dir","}","\/","{","network","}","\/scripts\/algo.py","``"]
code: def __call__(
      self,
      trial: Any,
      obj_filename: str,
      output_folder: str = ".",
      template_path: PathLike | None = None,
  ) -> Any:
      """
      Callable that Optuna will use to optimize the hyper-parameters
  
      Args:
          obj_filename: the pickle-exported Algo object.
          output_folder: the root path of the algorithms templates.
          template_path: the algorithm_template. It must contain algo.py in the follow path:
              ``{algorithm_templates_dir}/{network}/scripts/algo.py``
      """
      self.set_trial(trial)
      self.run_algo(obj_filename, output_folder, template_path)
      return self.acc
  
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 6 for calling the OptunaGen obj's underlying member method code with example usage: obj.__call__(trial, obj_filename, output_folder, template_path) and returns: self