automl / NASLib

NASLib is a Neural Architecture Search (NAS) library for facilitating NAS research for the community by providing interfaces to several state-of-the-art NAS search spaces and optimizers.
Apache License 2.0
512 stars 117 forks source link

Correspondance between numbers and operations in NAS-Bench-Zero-Suite. #144

Closed yoichii closed 1 year ago

yoichii commented 1 year ago

Thank you for your fantastic work NAS-Bench-Zero-Suite. I found a lot of zc_<name_of_nasbench>.json like zc_nasbench201.json, but I can't tell what tuples represent what actual architectures in the search space. For example, I don't know (4, 0, 3, 1, 4, 3) in zc_nas-bench-201.json represents what architecture (like |avg_pool_3x3~0|+|skip_connect~0|nor_conv_1x1~1|+|none~0|avg_pool_3x3~1|nor_conv_1x1~2|). I would be glad to know. Thank you.

Neonkraft commented 1 year ago

Hello @yoichii, Thank you for your interest in our project!

To convert the tuple representation to nb201 style arch string, you can use this snippet:

from naslib.search_spaces import NasBench201SearchSpace
from naslib.search_spaces.nasbench201.conversions import convert_naslib_to_str

graph = NasBench201SearchSpace()
graph.set_spec((4, 0, 3, 1, 4, 3))

nb201_str = convert_naslib_to_str(graph)
print(nb201_str)

Admittedly, it would be much better to have a convenience function which directly converts the tuple to the string, without having to instantiate the model. We'll be adding that functionality shortly.