class_docstr: This class generates a set of bundles according to the cross-validation folds, each of them can run independently.
  
  Args:
      algo_path: the directory path to save the algorithm templates. Default is the current working dir.
      algos: If dictionary, it outlines the algorithm to use. If a list or a string, defines a subset of names of
          the algorithms to use, e.g. ('segresnet', 'dints') out of the full set of algorithm templates provided
          by templates_path_or_url. Defaults to None - to use all available algorithms.
      templates_path_or_url: the folder with the algorithm templates or a url. If None provided, the default template
          zip url will be downloaded and extracted into the algo_path. The current default options are released at:
          https://github.com/Project-MONAI/research-contributions/tree/main/auto3dseg.
      data_stats_filename: the path to the data stats file (generated by DataAnalyzer).
      data_src_cfg_name: the path to the data source config YAML file. The config will be in a form of
                         {"modality": "ct", "datalist": "path_to_json_datalist", "dataroot": "path_dir_data"}.
      mlflow_tracking_uri: a tracking URI for MLflow server which could be local directory or address of
          the remote tracking Server; MLflow runs will be recorded locally in algorithms' model folder if
          the value is None.
  .. code-block:: bash
  
      python -m monai.apps.auto3dseg BundleGen generate --data_stats_filename="../algorithms/datastats.yaml"
docstr: Generate the bundle scripts/configs for each bundleAlgo
  
  Args:
      output_folder: the output folder to save each algorithm.
      num_fold: the number of cross validation fold.
      gpu_customization: the switch to determine automatically customize/optimize bundle script/config
          parameters for each bundleAlgo based on gpus. Custom parameters are obtained through dummy
          training to simulate the actual model training process and hyperparameter optimization (HPO)
          experiments.
      gpu_customization_specs: the dictionary to enable users overwrite the HPO settings. user can
          overwrite part of variables as follows or all of them. The structure is as follows.
      allow_skip: a switch to determine if some Algo in the default templates can be skipped based on the
          analysis on the dataset from Auto3DSeg DataAnalyzer.
  
          .. code-block:: python
  
              gpu_customization_specs = {
                  'ALGO': {
                      'num_trials': 6,
                      'range_num_images_per_batch': [1, 20],
                      'range_num_sw_batch_size': [1, 20]
                  }
              }
  
      ALGO: the name of algorithm. It could be one of algorithm names (e.g., 'dints') or 'universal' which
          would apply changes to all algorithms. Possible options are
  
          - {``"universal"``, ``"dints"``, ``"segresnet"``, ``"segresnet2d"``, ``"swinunetr"``}.
  
      num_trials: the number of HPO trials/experiments to run.
      range_num_images_per_batch: the range of number of images per mini-batch.
      range_num_sw_batch_size: the range of batch size in sliding-window inferer.
docstr_tok: ["Generate","the","bundle","scripts\/configs","for","each","bundleAlgo","Args",":","output_folder",":","the","output","folder","to","save","each","algorithm",".","num_fold",":","the","number","of","cross","validation","fold",".","gpu_customization",":","the","switch","to","determine","automatically","customize\/optimize","bundle","script\/config","parameters","for","each","bundleAlgo","based","on","gpus",".","Custom","parameters","are","obtained","through","dummy","training","to","simulate","the","actual","model","training","process","and","hyperparameter","optimization","(","HPO",")","experiments",".","gpu_customization_specs",":","the","dictionary","to","enable","users","overwrite","the","HPO","settings",".","user","can","overwrite","part","of","variables","as","follows","or","all","of","them",".","The","structure","is","as","follows",".","allow_skip",":","a","switch","to","determine","if","some","Algo","in","the","default","templates","can","be","skipped","based","on","the","analysis","on","the","dataset","from","Auto3DSeg","DataAnalyzer",".","..","code-block",":",":","python","gpu_customization_specs","=","{","'ALGO","'",":","{","'num_trials","'",":","6",",","'range_num_images_per_batch","'",":","[","1",",","20","]",",","'range_num_sw_batch_size","'",":","[","1",",","20","]","}","}","ALGO",":","the","name","of","algorithm",".","It","could","be","one","of","algorithm","names","(","e.g.",",","'dints","'",")","or","'universal","'","which","would","apply","changes","to","all","algorithms",".","Possible","options","are","-","{","``","``","universal","''","``",",","``","``","dints","''","``",",","``","``","segresnet","''","``",",","``","``","segresnet2d","''","``",",","``","``","swinunetr","''","``","}",".","num_trials",":","the","number","of","HPO","trials\/experiments","to","run",".","range_num_images_per_batch",":","the","range","of","number","of","images","per","mini-batch",".","range_num_sw_batch_size",":","the","range","of","batch","size","in","sliding-window","inferer","."]
code: def generate(
      self,
      output_folder: str = ".",
      num_fold: int = 5,
      gpu_customization: bool = False,
      gpu_customization_specs: dict[str, Any] | None = None,
      allow_skip: bool = True,
  ) -> None:
      """
      Generate the bundle scripts/configs for each bundleAlgo
  
      Args:
          output_folder: the output folder to save each algorithm.
          num_fold: the number of cross validation fold.
          gpu_customization: the switch to determine automatically customize/optimize bundle script/config
              parameters for each bundleAlgo based on gpus. Custom parameters are obtained through dummy
              training to simulate the actual model training process and hyperparameter optimization (HPO)
              experiments.
          gpu_customization_specs: the dictionary to enable users overwrite the HPO settings. user can
              overwrite part of variables as follows or all of them. The structure is as follows.
          allow_skip: a switch to determine if some Algo in the default templates can be skipped based on the
              analysis on the dataset from Auto3DSeg DataAnalyzer.
  
              .. code-block:: python
  
                  gpu_customization_specs = {
                      'ALGO': {
                          'num_trials': 6,
                          'range_num_images_per_batch': [1, 20],
                          'range_num_sw_batch_size': [1, 20]
                      }
                  }
  
          ALGO: the name of algorithm. It could be one of algorithm names (e.g., 'dints') or 'universal' which
              would apply changes to all algorithms. Possible options are
  
              - {``"universal"``, ``"dints"``, ``"segresnet"``, ``"segresnet2d"``, ``"swinunetr"``}.
  
          num_trials: the number of HPO trials/experiments to run.
          range_num_images_per_batch: the range of number of images per mini-batch.
          range_num_sw_batch_size: the range of batch size in sliding-window inferer.
      """
      fold_idx = list(range(num_fold))
      for algo in self.algos:
          for f_id in ensure_tuple(fold_idx):
              data_stats = self.get_data_stats()
              data_src_cfg = self.get_data_src()
              mlflow_tracking_uri = self.get_mlflow_tracking_uri()
              gen_algo = deepcopy(algo)
              gen_algo.set_data_stats(data_stats)
              gen_algo.set_data_source(data_src_cfg)
              gen_algo.set_mlflow_tracking_uri(mlflow_tracking_uri)
              name = f"{gen_algo.name}_{f_id}"
  
              if allow_skip:
                  (
                      skip_bundlegen,
                      skip_info,
                  ) = gen_algo.pre_check_skip_algo()
                  if skip_bundlegen:
                      logger.info(f"{name} is skipped! {skip_info}")
                      continue
  
              if gpu_customization:
                  gen_algo.export_to_disk(
                      output_folder,
                      name,
                      fold=f_id,
                      gpu_customization=True,
                      gpu_customization_specs=gpu_customization_specs,
                  )
              else:
                  gen_algo.export_to_disk(
                      output_folder, name, fold=f_id
                  )
  
              algo_to_pickle(gen_algo, template_path=algo.template_path)
              self.history.append(
                  {AlgoKeys.ID: name, AlgoKeys.ALGO: gen_algo}
              )
  
imports: from __future__ import annotations
  import importlib
  import os
  import re
  import shutil
  import subprocess
  import sys
  import time
  import warnings
  from copy import deepcopy
  from pathlib import Path
  from tempfile import TemporaryDirectory
  from typing import Any
  from urllib.parse import urlparse
  import torch
  from monai.apps import download_and_extract
  from monai.apps.utils import get_logger
  from monai.auto3dseg.algo_gen import Algo, AlgoGen
  from monai.auto3dseg.utils import _prepare_cmd_bcprun, _prepare_cmd_default, _prepare_cmd_torchrun, _run_cmd_bcprun, _run_cmd_torchrun, algo_to_pickle
  from monai.bundle.config_parser import ConfigParser
  from monai.config import PathLike
  from monai.utils import ensure_tuple, look_up_option, run_cmd
  from monai.utils.enums import AlgoKeys
  from monai.utils.misc import MONAIEnvVars
label_desc: Use image node_id 9 for calling the BundleGen obj's underlying member method code with example usage: obj.generate(output_folder, num_fold, gpu_customization, gpu_customization_specs, allow_skip) without return types