class_docstr: Auto Multi-class HeteroGraph Node Classifier.
  
  Used to automatically solve the heterogeneous node classification problems.
  
  Parameters
  ----------
  feature_module: autogl.module.feature.BaseFeatureEngineer or str or None
      The (name of) auto feature engineer used to process the given dataset. Default ``deepgl``.
      Disable feature engineer by setting it to ``None``.
  
  graph_models: list of autogl.module.model.BaseModel or list of str
      The (name of) models to be optimized as backbone. Default ``['gat', 'gcn']``.
  
  hpo_module: autogl.module.hpo.BaseHPOptimizer or str or None
      The (name of) hpo module used to search for best hyper parameters. Default ``anneal``.
      Disable hpo by setting it to ``None``.
  
  ensemble_module: autogl.module.ensemble.BaseEnsembler or str or None
      The (name of) ensemble module used to ensemble the multi-models found. Default ``voting``.
      Disable ensemble by setting it to ``None``.
  
  max_evals: int (Optional)
      If given, will set the number eval times the hpo module will use.
      Only be effective when hpo_module is ``str``. Default ``None``.
  
  default_trainer: str (Optional)
      The (name of) the trainer used in this solver. Default to ``NodeClassificationFull``.
  
  trainer_hp_space: list of dict (Optional)
      trainer hp space or list of trainer hp spaces configuration.
      If a single trainer hp is given, will specify the hp space of trainer for every model.
      If a list of trainer hp is given, will specify every model with corrsponding
      trainer hp space.
      Default ``None``.
  
  model_hp_spaces: list of list of dict (Optional)
      model hp space configuration.
      If given, will specify every hp space of every passed model. Default ``None``.
      If the encoder(-decoder) is passed, the space should be a dict containing keys "encoder"
      and "decoder", specifying the detailed encoder decoder hp spaces.
  
  size: int (Optional)
      The max models ensemble module will use. Default ``None``.
  
  device: torch.device or str
      The device where model will be running on. If set to ``auto``, will use gpu when available.
      You can also specify the device by directly giving ``gpu`` or ``cuda:0``, etc.
      Default ``auto``.
class_docstr_tok: ["Auto","Multi-class","HeteroGraph","Node","Classifier",".","Used","to","automatically","solve","the","heterogeneous","node","classification","problems",".","Parameters","--","--","--","--","--","feature_module",":","autogl.module.feature.BaseFeatureEngineer","or","str","or","None","The","(","name","of",")","auto","feature","engineer","used","to","process","the","given","dataset",".","Default","``","deepgl","``",".","Disable","feature","engineer","by","setting","it","to","``","None","``",".","graph_models",":","list","of","autogl.module.model.BaseModel","or","list","of","str","The","(","name","of",")","models","to","be","optimized","as","backbone",".","Default","``","[","'gat","'",",","'gcn","'","]","``",".","hpo_module",":","autogl.module.hpo.BaseHPOptimizer","or","str","or","None","The","(","name","of",")","hpo","module","used","to","search","for","best","hyper","parameters",".","Default","``","anneal","``",".","Disable","hpo","by","setting","it","to","``","None","``",".","ensemble_module",":","autogl.module.ensemble.BaseEnsembler","or","str","or","None","The","(","name","of",")","ensemble","module","used","to","ensemble","the","multi-models","found",".","Default","``","voting","``",".","Disable","ensemble","by","setting","it","to","``","None","``",".","max_evals",":","int","(","Optional",")","If","given",",","will","set","the","number","eval","times","the","hpo","module","will","use",".","Only","be","effective","when","hpo_module","is","``","str","``",".","Default","``","None","``",".","default_trainer",":","str","(","Optional",")","The","(","name","of",")","the","trainer","used","in","this","solver",".","Default","to","``","NodeClassificationFull","``",".","trainer_hp_space",":","list","of","dict","(","Optional",")","trainer","hp","space","or","list","of","trainer","hp","spaces","configuration",".","If","a","single","trainer","hp","is","given",",","will","specify","the","hp","space","of","trainer","for","every","model",".","If","a","list","of","trainer","hp","is","given",",","will","specify","every","model","with","corrsponding","trainer","hp","space",".","Default","``","None","``",".","model_hp_spaces",":","list","of","list","of","dict","(","Optional",")","model","hp","space","configuration",".","If","given",",","will","specify","every","hp","space","of","every","passed","model",".","Default","``","None","``",".","If","the","encoder","(","-decoder",")","is","passed",",","the","space","should","be","a","dict","containing","keys","``","encoder","''","and","``","decoder","''",",","specifying","the","detailed","encoder","decoder","hp","spaces",".","size",":","int","(","Optional",")","The","max","models","ensemble","module","will","use",".","Default","``","None","``",".","device",":","torch.device","or","str","The","device","where","model","will","be","running","on",".","If","set","to","``","auto","``",",","will","use","gpu","when","available",".","You","can","also","specify","the","device","by","directly","giving","``","gpu","``","or","``","cuda:0","``",",","etc",".","Default","``","auto","``","."]
docstr: Load solver from config file.
  
  You can use this function to directly load a solver from predefined config dict
  or config file path. Currently, only support file type of ``json`` or ``yaml``,
  if you pass a path.
  
  Parameters
  ----------
  path_or_dict: str or dict
      The path to the config file or the config dictionary object
  
  filetype: str
      The filetype the given file if the path is specified. Currently only support
      ``json`` or ``yaml``. You can set to ``auto`` to automatically detect the file
      type (from file name). Default ``auto``.
  
  Returns
  -------
  solver: autogl.solver.AutoGraphClassifier
      The solver that is created from given file or dictionary.
docstr_tok: ["Load","solver","from","config","file",".","You","can","use","this","function","to","directly","load","a","solver","from","predefined","config","dict","or","config","file","path",".","Currently",",","only","support","file","type","of","``","json","``","or","``","yaml","``",",","if","you","pass","a","path",".","Parameters","--","--","--","--","--","path_or_dict",":","str","or","dict","The","path","to","the","config","file","or","the","config","dictionary","object","filetype",":","str","The","filetype","the","given","file","if","the","path","is","specified",".","Currently","only","support","``","json","``","or","``","yaml","``",".","You","can","set","to","``","auto","``","to","automatically","detect","the","file","type","(","from","file","name",")",".","Default","``","auto","``",".","Returns","--","--","--","-","solver",":","autogl.solver.AutoGraphClassifier","The","solver","that","is","created","from","given","file","or","dictionary","."]
code: def from_config(
      cls, path_or_dict, filetype="auto"
  ) -> "AutoHeteroNodeClassifier":
      """
      Load solver from config file.
  
      You can use this function to directly load a solver from predefined config dict
      or config file path. Currently, only support file type of ``json`` or ``yaml``,
      if you pass a path.
  
      Parameters
      ----------
      path_or_dict: str or dict
          The path to the config file or the config dictionary object
  
      filetype: str
          The filetype the given file if the path is specified. Currently only support
          ``json`` or ``yaml``. You can set to ``auto`` to automatically detect the file
          type (from file name). Default ``auto``.
  
      Returns
      -------
      solver: autogl.solver.AutoGraphClassifier
          The solver that is created from given file or dictionary.
      """
      assert filetype in ["auto", "yaml", "json"], (
          "currently only support yaml file or json file type, but get type "
          + filetype
      )
      if isinstance(path_or_dict, str):
          if filetype == "auto":
              if path_or_dict.endswith(
                  ".yaml"
              ) or path_or_dict.endswith(".yml"):
                  filetype = "yaml"
              elif path_or_dict.endswith(".json"):
                  filetype = "json"
              else:
                  LOGGER.error(
                      "cannot parse the type of the given file name, "
                      "please manually set the file type"
                  )
                  raise ValueError(
                      "cannot parse the type of the given file name, "
                      "please manually set the file type"
                  )
          if filetype == "yaml":
              path_or_dict = yaml.load(
                  open(path_or_dict, "r").read(), Loader=yaml.FullLoader
              )
          else:
              path_or_dict = json.load(open(path_or_dict, "r"))
  
      path_or_dict = deepcopy(path_or_dict)
      solver = cls(None, [], None, None)
  
      models = path_or_dict.pop(
          "models", [{"name": "hgt"}, {"name": "han"}]
      )
      # models should be a list of model
      # with each element in two cases
      # * a dict describing a certain model
      # * a dict containing {"encoder": encoder, "decoder": decoder}
      model_hp_space = [_parse_model_hp(model) for model in models]
      model_list = [_initialize_single_model(model) for model in models]
  
      trainer = path_or_dict.pop("trainer", None)
      default_trainer = "NodeClassificationHet"
      trainer_space = None
      if isinstance(trainer, dict):
          # global default
          default_trainer = trainer.pop("name", "NodeClassificationHet")
          trainer_space = _parse_hp_space(trainer.pop("hp_space", None))
          default_kwargs = {"num_features": None, "num_classes": None}
          default_kwargs.update(trainer)
          default_kwargs["init"] = False
          for i in range(len(model_list)):
              model = model_list[i]
              trainer_wrap = TRAINER_DICT[default_trainer](
                  model=model, **default_kwargs
              )
              model_list[i] = trainer_wrap
      elif isinstance(trainer, list):
          # sequential trainer definition
          assert len(trainer) == len(
              model_list
          ), "The number of trainer and model does not match"
          trainer_space = []
          for i in range(len(model_list)):
              train, model = trainer[i], model_list[i]
              default_trainer = train.pop(
                  "name", "NodeClassificationHet"
              )
              trainer_space.append(
                  _parse_hp_space(train.pop("hp_space", None))
              )
              default_kwargs = {
                  "num_features": None,
                  "num_classes": None,
              }
              default_kwargs.update(train)
              default_kwargs["init"] = False
              trainer_wrap = TRAINER_DICT[default_trainer](
                  model=model, **default_kwargs
              )
              model_list[i] = trainer_wrap
  
      solver.set_graph_models(
          model_list, default_trainer, trainer_space, model_hp_space
      )
  
      hpo_dict = path_or_dict.pop("hpo", {"name": "anneal"})
      if hpo_dict is not None:
          name = hpo_dict.pop("name")
          solver.set_hpo_module(name, **hpo_dict)
  
      ensemble_dict = path_or_dict.pop("ensemble", {"name": "voting"})
      if ensemble_dict is not None:
          name = ensemble_dict.pop("name")
          solver.set_ensemble_module(name, **ensemble_dict)
  
      return solver
  
imports: import time
  import json
  from copy import deepcopy
  from typing import Sequence
  import torch
  import numpy
  import yaml
  from ..base import BaseClassifier
  from ...base import _parse_hp_space, _initialize_single_model, _parse_model_hp
  from ....module.train import TRAINER_DICT, BaseNodeClassificationHetTrainer
  from ....module.train import get_feval
  from ...utils import LeaderBoard, set_seed
  from ....utils import get_logger
label_desc: Use image node_id 9 for calling the AutoHeteroNodeClassifier obj's underlying member method code with example usage: obj.from_config(cls, path_or_dict, filetype) and returns: solver