class_docstr: An algorithm represented by a set of bundle configurations and scripts.
  
  ``BundleAlgo.cfg`` is a ``monai.bundle.ConfigParser`` instance.
  
  .. code-block:: python
  
      from monai.apps.auto3dseg import BundleAlgo
  
      data_stats_yaml = "../datastats.yaml"
      algo = BundleAlgo(template_path="../algorithm_templates")
      algo.set_data_stats(data_stats_yaml)
      # algo.set_data_src("../data_src.json")
      algo.export_to_disk(".", algo_name="segresnet2d_1")
  
  This class creates MONAI bundles from a directory of 'bundle template'. Different from the regular MONAI bundle
  format, the bundle template may contain placeholders that must be filled using ``fill_template_config`` during
  ``export_to_disk``. Then created bundle keeps the same file structure as the template.
docstr: Load the InferClass from the infer.py. The InferClass should be defined in the template under the path of
  `"scripts/infer.py"`. It is required to define the "InferClass" (name is fixed) with two functions at least
  (``__init__`` and ``infer``). The init class has an override kwargs that can be used to override parameters in
  the run-time optionally.
  
  Examples:
  
  .. code-block:: python
  
      class InferClass
          def __init__(self, config_file: Optional[Union[str, Sequence[str]]] = None, **override):
              # read configs from config_file (sequence)
              # set up transforms
              # set up model
              # set up other hyper parameters
              return
  
          @torch.no_grad()
          def infer(self, image_file):
              # infer the model and save the results to output
              return output
docstr_tok: ["Load","the","InferClass","from","the","infer.py",".","The","InferClass","should","be","defined","in","the","template","under","the","path","of","`","``","scripts\/infer.py","''","`",".","It","is","required","to","define","the","``","InferClass","''","(","name","is","fixed",")","with","two","functions","at","least","(","``","__init__","``","and","``","infer","``",")",".","The","init","class","has","an","override","kwargs","that","can","be","used","to","override","parameters","in","the","run-time","optionally",".","Examples",":","..","code-block",":",":","python","class","InferClass","def","__init__","(","self",",","config_file",":","Optional","[","Union","[","str",",","Sequence","[","str","]","]","]","=","None",",","*","*","override",")",":","#","read","configs","from","config_file","(","sequence",")","#","set","up","transforms","#","set","up","model","#","set","up","other","hyper","parameters","return","@","torch.no_grad","(",")","def","infer","(","self",",","image_file",")",":","#","infer","the","model","and","save","the","results","to","output","return","output"]
code: def get_inferer(self, *args, **kwargs):
      """
      Load the InferClass from the infer.py. The InferClass should be defined in the template under the path of
      `"scripts/infer.py"`. It is required to define the "InferClass" (name is fixed) with two functions at least
      (``__init__`` and ``infer``). The init class has an override kwargs that can be used to override parameters in
      the run-time optionally.
  
      Examples:
  
      .. code-block:: python
  
          class InferClass
              def __init__(self, config_file: Optional[Union[str, Sequence[str]]] = None, **override):
                  # read configs from config_file (sequence)
                  # set up transforms
                  # set up model
                  # set up other hyper parameters
                  return
  
              @torch.no_grad()
              def infer(self, image_file):
                  # infer the model and save the results to output
                  return output
  
      """
      infer_py = os.path.join(self.output_path, "scripts", "infer.py")
      if not os.path.isfile(infer_py):
          raise ValueError(
              f"{infer_py} is not found, please check the path."
          )
  
      config_dir = os.path.join(self.output_path, "configs")
      configs_path = [
          os.path.join(config_dir, f) for f in os.listdir(config_dir)
      ]
  
      spec = importlib.util.spec_from_file_location(
          "InferClass", infer_py
      )
      infer_class = importlib.util.module_from_spec(spec)  # type: ignore
      sys.modules["InferClass"] = infer_class
      spec.loader.exec_module(infer_class)  # type: ignore
      return infer_class.InferClass(configs_path, *args, **kwargs)
  
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 12 for calling the BundleAlgo obj's underlying member method code with example usage: obj.get_inferer() and returns: infer_class