neural_compressor.experimental.nas

NAS module.

Subpackages

Submodules

Package Contents

Classes

BasicNAS

Basic NAS approach.

DyNAS

DyNAS approach.

NAS

Create object of different NAS approaches.

class neural_compressor.experimental.nas.BasicNAS(conf_fname_or_obj, search_space=None, model_builder=None)

Bases: neural_compressor.experimental.nas.nas.NASBase, neural_compressor.experimental.component.Component

Basic NAS approach.

Defining the pipeline for basic NAS approach.

Parameters:
  • conf_fname (string) – The path to the YAML configuration file.

  • search_space (dict) – A dictionary for defining the search space.

  • model_builder (function obj) – A function to build model instance with the specified model architecture parameters.

execute()

Execute the search process.

Returns:

Best model architectures found in the search process.

estimate(model)

Estimate performance of the model.

Depends on specific NAS algorithm. Here we use train and evaluate.

Returns:

Evaluated metrics of the model.

init_by_cfg(conf_fname_or_obj)

Initialize the configuration.

pre_process()

Initialize the train and evaluation settings.

class neural_compressor.experimental.nas.DyNAS(conf_fname_or_obj)

Bases: neural_compressor.experimental.nas.nas.NASBase

DyNAS approach.

Defining the pipeline for DyNAS approach.

Parameters:

conf_fname_or_obj (string or obj) – The path to the YAML configuration file or the object of NASConfig.

estimate(individual)

Estimate performance of the model.

Returns:

Evaluated metrics of the model.

Initialize the search configuration.

search()

Execute the search process.

Returns:

Best model architectures found in the search process.

select_model_arch()

Select the model architecture.

create_acc_predictor()

Create the accuracy predictor.

create_macs_predictor()

Create the MACs predictor.

create_latency_predictor()

Create the latency predictor.

init_cfg(conf_fname_or_obj)

Initialize the configuration.

class neural_compressor.experimental.nas.NAS

Bases: object

Create object of different NAS approaches.

Parameters:

conf_fname_or_obj (string or obj) – The path to the YAML configuration file or the object of NASConfig.

Returns:

An object of specified NAS approach.