class_docstr: Config for NAS experiment.
  
  Other than training service fields which also exists in a HPO experiment,
  additional fields provided by NAS include execution engine and model format.
  Execution engine is used to specify how to (e.g., distributedly or sequentially) run a trial,
  and model format specifies the format of the converted model space used throughout the NAS experiment.
  
  It can be constructed via 3 approaches.
  
  1. Create a default config and then modify some fields (recommended).
     The default config should be good enough for most cases. Users only need to update some fields like concurrency.
     See details in :meth:`default`. Example::
  
      config = NasExperimentConfig.default(model_space, evaluator, strategy)
      config.trial_concurrency = 4
  
  2. Create an object by providing several required fields, and then set other fields.
     Though marked as optional in function signature, it's recommended to set all three fields.
  
      config = NasExperimentConfig('ts', 'graph', 'local')
      config.experiment_name = 'hello'
      config.execution_engine.dummy_input = [1, 3, 224, 224]
  
  3. Create an empty object and set all fields manually. Put the fields into kwargs should also work::
  
      config = NasExperimentConfig()
      config.execution_engine = TrainingServiceEngineConfig()
      config.model_format = SimplifiedModelFormatConfig()
      config.training_service = LocalConfig(use_active_gpu=True)
  
      # equivalent to
      config = NasExperimentConfig(
          execution_engine=TrainingServiceEngineConfig(),
          model_format=SimplifiedModelFormatConfig(),
          training_service=LocalConfig(use_active_gpu=True)
      )
docstr: Instantiate a default config. Infer from current setting of model space, evaluator and strategy.
  
  If the strategy is found to be a one-shot strategy, the execution engine will be set to "sequential" and
  model format will be set to "raw" to preserve the weights and the model object.
  
  If the strategy is found to be a multi-trial strategy, training service engine will be used by default,
  and the training service will be set to "local" if not provided.
  Model format will be set to "simplified" for performance and memory efficiency.
docstr_tok: ["Instantiate","a","default","config",".","Infer","from","current","setting","of","model","space",",","evaluator","and","strategy",".","If","the","strategy","is","found","to","be","a","one-shot","strategy",",","the","execution","engine","will","be","set","to","``","sequential","''","and","model","format","will","be","set","to","``","raw","''","to","preserve","the","weights","and","the","model","object",".","If","the","strategy","is","found","to","be","a","multi-trial","strategy",",","training","service","engine","will","be","used","by","default",",","and","the","training","service","will","be","set","to","``","local","''","if","not","provided",".","Model","format","will","be","set","to","``","simplified","''","for","performance","and","memory","efficiency","."]
code: def default(
      cls,
      model_space: "BaseModelSpace",
      evaluator: "Evaluator",
      strategy: "Strategy",
  ) -> "NasExperimentConfig":
      """Instantiate a default config. Infer from current setting of model space, evaluator and strategy.
  
      If the strategy is found to be a one-shot strategy, the execution engine will be set to "sequential" and
      model format will be set to "raw" to preserve the weights and the model object.
  
      If the strategy is found to be a multi-trial strategy, training service engine will be used by default,
      and the training service will be set to "local" if not provided.
      Model format will be set to "simplified" for performance and memory efficiency.
      """
      _logger.info("Config is not provided. Will try to infer.")
  
      trial_concurrency = 1  # no effect if not going parallel
      training_service = (
          "local"  # no effect if not using training service
      )
  
      execution_engine = None
      model_format = None
  
      try:
          from nni.nas.oneshot.pytorch.strategy import (
              OneShotStrategy,
              is_supernet,
          )
          from nni.nas.nn.pytorch import ModelSpace
  
          if isinstance(strategy, OneShotStrategy):
              _logger.info(
                  "Strategy is found to be a one-shot strategy. "
                  'Setting execution engine to "sequential" and format to "raw".'
              )
              execution_engine = "sequential"
              model_format = "raw"
          if isinstance(model_space, ModelSpace) and is_supernet(
              model_space
          ):
              _logger.info(
                  "Model space is found to be a one-shot supernet. "
                  'Setting execution engine to "sequential" and format to "raw" to preserve the weights.'
              )
              execution_engine = "sequential"
              model_format = "raw"
      except ImportError:
          _logger.warning(
              "Import of one-shot strategy failed. Assuming the strategy is not one-shot."
          )
  
      if execution_engine is None:
          _logger.info(
              "Using execution engine based on training service. Trial concurrency is set to 1."
          )
          execution_engine = "ts"
      if model_format is None:
          _logger.info("Using simplified model format.")
          model_format = "simplified"
  
      if execution_engine == "ts":
          _logger.info("Using local training service.")
  
          import torch
  
          if (
              torch.cuda.is_available()
              and torch.cuda.device_count() > 0
          ):
              _logger.warning(
                  "GPU found but will not be used. Please set `experiment.config.trial_gpu_number` to "
                  "the number of GPUs you want to use for each trial."
              )
  
      config = NasExperimentConfig(
          training_service_platform=training_service,
          execution_engine=execution_engine,
          model_format=model_format,
          trial_concurrency=trial_concurrency,
      )
  
      return config
  
file_path: nni/nni/nas/experiment/config/experiment.py
imports: import logging
  import sys
  from dataclasses import dataclass
  from pathlib import Path
  from typing import Any, Dict, Optional, TYPE_CHECKING, Union, List
  from typing_extensions import Literal
  from nni.experiment.config import utils, ExperimentConfig
  from .engine import ExecutionEngineConfig, SequentialEngineConfig
  from .format import ModelFormatConfig
label_desc: Use image node_id 2 for calling the NasExperimentConfig obj's underlying member method code with example usage: obj.default(cls, model_space, evaluator, strategy) and returns: config