Benchmark#

NATS-Bench#

class archai.discrete_search.search_spaces.benchmark.natsbench_tss.NatsbenchTssSearchSpace(natsbench_location: str, base_dataset: str, seed: int | None = 1)[source]#

Search space for NATS-Bench-TSS.

OPS = ['none', 'avg_pool_3x3', 'nor_conv_1x1', 'nor_conv_3x3', 'skip_connect']#
model_from_natsbench_tss(natsbench_id: int) Any[source]#

Get a model from NATS-Bench-TSS dataset.

Parameters:

natsbench_id – NATS-Bench-TSS identifier.

Returns:

Model from NATS-Bench-TSS dataset.

save_arch(model: ArchaiModel, path: str) None[source]#

Save an architecture to a file without saving the weights.

Parameters:
  • model – Model’s architecture to save.

  • file_path – File path to save the architecture.

load_arch(path: str) ArchaiModel[source]#

Load from a file an architecture that was saved using SearchSpace.save_arch().

Parameters:

file_path – File path to load the architecture.

Returns:

Loaded model.

load_model_weights(model: ArchaiModel, path: str) None[source]#

Load the weights (created with SearchSpace.save_model_weights()) into a model of the same architecture.

Parameters:
  • model – Model to load the weights.

  • file_path – File path to load the weights.

save_model_weights(model: ArchaiModel, path: str) None[source]#

Save the weights of a model.

Parameters:
  • model – Model to save the weights.

  • file_path – File path to save the weights.

random_sample() ArchaiModel[source]#

Randomly sample an architecture from the search spaces.

Returns:

Sampled architecture.

mutate(model: ArchaiModel) ArchaiModel[source]#

Reused from naszilla/naszilla.

crossover(arch_list: List[ArchaiModel]) ArchaiModel[source]#

Combine a list of architectures into a new one.

Parameters:

arch_list – List of architectures.

Returns:

Resulting model.

encode(arch: ArchaiModel) ndarray[source]#

Encode an architecture into a fixed-length vector representation.

Parameters:

arch – Model from the search space.

Returns:

Fixed-length vector representation of arch.