NAS- 벤치 -201이 Nats-Bench로 확장 되었으므로이 저장소는 더 이상 사용되지 않으며 유지 관리되지 않습니다. NAS-Bench-201보다 5 배 더 많은 아키텍처 정보와 더 빠른 API가있는 Nats-Bench를 사용하십시오.
우리는 고정 검색 공간이있는 알고리즘-비 공연 NAS 벤치 마크 (NAS-Bench-201)를 제안하여 거의 모든 최신 NAS 알고리즘에 대한 통합 벤치 마크를 제공합니다. 검색 공간의 디자인은 셀이 지시 된 acyclic 그래프로 표시되는 가장 인기있는 셀 기반 검색 알고리즘에 사용 된 것들에서 영감을 얻습니다. 여기의 각 모서리는 사전 정의 된 작업 세트에서 선택한 작업과 관련이 있습니다. 모든 NAS 알고리즘에 적용 할 수 있으려면 NAS-Bench-201에 정의 된 검색 공간에는 4 개의 노드와 5 개의 관련 작업 옵션이 포함되어 있으며, 이는 총 15,625 개의 신경 셀 후보를 생성합니다.
이 Markdown 파일에서는 다음을 제공합니다.
다음 두 가지 경우 AutoDl-Projects를 사용하십시오.
참고 : PyTorch >= 1.2.0
및 Python >= 3.6.0
사용하십시오.
pip install nas-bench-201
입력하여 API를 설치할 수 있습니다. 이 repo의 nas-bench-201
모듈의 소스 코드를 참조하십시오.
질문이나 문제가 있으시면 여기에 게시하거나 이메일을 보내주십시오.
NAS-Bench-201의 이전 벤치 마크 파일은 Google Drive 또는 Baidu-Wangpan (Code : 6U5D)에서 다운로드 할 수 있습니다.
[권장] NAS-Bench-201의 최신 벤치 마크 파일 ( NAS-Bench-201-v1_1-096897.pth
)은 Google 드라이브에서 다운로드 할 수 있습니다. 모델 가중치에 대한 파일이 너무 커서 (431g) 업로드하는 데 시간이 필요합니다. 이해해 주셔서 감사합니다.
원하는 곳으로 이동하고 초기화를 위해 API로 경로를 보낼 수 있습니다.
NAS-Bench-201-v1_0-e61699.pth
(2.2G), 여기서 e61699
는이 파일의 마지막 6 자리입니다. 각 시험의 훈련 된 무게를 제외한 모든 정보가 포함되어 있습니다.NAS-Bench-201-v1_1-096897.pth
(4.7G), 여기서 096897
은이 파일의 마지막 6 자리입니다. 여기에는 NAS-Bench-201-v1_0-e61699.pth
와 비교하여 더 많은 시험에 대한 정보가 포함되어 있으며, 특히 모든 데이터 세트에서 12 개의 에포크로 훈련 된 모든 모델은 불가능합니다. NAS-Bench-201-v1_1-096897.pth
사용하는 것이 좋습니다
NAS-Bench-201에 사용 된 교육 및 평가 데이터는 Google Drive 또는 Baidu-Wangpan (Code : 4FG7)에서 다운로드 할 수 있습니다. 이 데이터를 $TORCH_HOME
( ~/.torch/
기본적으로)에 넣는 것이 좋습니다. NAS-Bench-201 또는 이와 유사한 NAS 데이터 세트 또는 교육 모델을 직접 생성하려면 이러한 데이터가 필요합니다.
테스트 코드에서 더 많은 사용법을 찾을 수 있습니다 .
from nas_201_api import NASBench201API as API
api = API('$path_to_meta_nas_bench_file')
# Create an API without the verbose log
api = API('NAS-Bench-201-v1_1-096897.pth', verbose=False)
# The default path for benchmark file is '{:}/{:}'.format(os.environ['TORCH_HOME'], 'NAS-Bench-201-v1_1-096897.pth')
api = API(None)
len(api)
및 각 아키텍처 api[i]
의 수를 보여줍니다. num = len(api)
for i, arch_str in enumerate(api):
print ('{:5d}/{:5d} : {:}'.format(i, len(api), arch_str))
# show all information for a specific architecture
api.show(1)
api.show(2)
# show the mean loss and accuracy of an architecture
info = api.query_meta_info_by_index(1) # This is an instance of `ArchResults`
res_metrics = info.get_metrics('cifar10', 'train') # This is a dict with metric names as keys
cost_metrics = info.get_comput_costs('cifar100') # This is a dict with metric names as keys, e.g., flops, params, latency
# get the detailed information
results = api.query_by_index(1, 'cifar100') # a dict of all trials for 1st net on cifar100, where the key is the seed
print ('There are {:} trials for this architecture [{:}] on cifar100'.format(len(results), api[1]))
for seed, result in results.items():
print ('Latency : {:}'.format(result.get_latency()))
print ('Train Info : {:}'.format(result.get_train()))
print ('Valid Info : {:}'.format(result.get_eval('x-valid')))
print ('Test Info : {:}'.format(result.get_eval('x-test')))
# for the metric after a specific epoch
print ('Train Info [10-th epoch] : {:}'.format(result.get_train(10)))
index = api.query_index_by_arch('|nor_conv_3x3~0|+|nor_conv_3x3~0|avg_pool_3x3~1|+|skip_connect~0|nor_conv_3x3~1|skip_connect~2|')
api.show(index)
이 문자열 |nor_conv_3x3~0|+|nor_conv_3x3~0|avg_pool_3x3~1|+|skip_connect~0|nor_conv_3x3~1|skip_connect~2|
수단:
node-0: the input tensor
node-1: conv-3x3( node-0 )
node-2: conv-3x3( node-0 ) + avg-pool-3x3( node-1 )
node-3: skip-connect( node-0 ) + conv-3x3( node-1 ) + skip-connect( node-2 )
config = api.get_net_config(123, 'cifar10') # obtain the network configuration for the 123-th architecture on the CIFAR-10 dataset
from models import get_cell_based_tiny_net # this module is in AutoDL-Projects/lib/models
network = get_cell_based_tiny_net(config) # create the network from configurration
print(network) # show the structure of this architecture
이 생성 된 네트워크의 훈련 된 가중치를로드하려면 api.get_net_param(123, ...)
사용하여 가중치를 얻은 다음 네트워크에로드해야합니다.
api.get_more_info(...)
는 교육 / 검증 / 테스트 세트에서 손실 / 정확도 / 시간을 반환 할 수 있습니다. 자세한 내용은 get_more_info 함수의 의견을 참조하십시오.
다른 사용법은 lib/nas_201_api/api.py
참조하십시오. 해당 기능에 대한 의견에 몇 가지 사용 정보를 제공합니다. 원하는 것이 제공되지 않으면 논의 할 문제를 자유롭게 열어 주시기 바랍니다. NAS-Bench-201에 관한 질문에 답해 드리겠습니다.
nas_201_api
에서는 NASBench201API
, ArchResults
, ResultsCount
의 세 가지 클래스를 정의합니다.
ResultsCount
특정 시험의 모든 정보를 유지합니다. 결과를 인스턴스화하고 다음 코드를 통해 정보를 얻을 수 있습니다 ( 000157-FULL.pth
157-th Architecture의 모든 시험의 모든 정보를 저장) :
from nas_201_api import ResultsCount
xdata = torch.load('000157-FULL.pth')
odata = xdata['full']['all_results'][('cifar10-valid', 777)]
result = ResultsCount.create_from_state_dict( odata )
print(result) # print it
print(result.get_train()) # print the final training loss/accuracy/[optional:time-cost-of-a-training-epoch]
print(result.get_train(11)) # print the training info of the 11-th epoch
print(result.get_eval('x-valid')) # print the final evaluation info on the validation set
print(result.get_eval('x-valid', 11)) # print the info on the validation set of the 11-th epoch
print(result.get_latency()) # print the evaluation latency [in batch]
result.get_net_param() # the trained parameters of this trial
arch_config = result.get_config(CellStructure.str2structure) # create the network with params
net_config = dict2config(arch_config, None)
network = get_cell_based_tiny_net(net_config)
network.load_state_dict(result.get_net_param())
ArchResults
아키텍처의 모든 시험의 모든 정보를 유지합니다. 다음 사용법을 참조하십시오.
from nas_201_api import ArchResults
xdata = torch.load('000157-FULL.pth')
archRes = ArchResults.create_from_state_dict(xdata['less']) # load trials trained with 12 epochs
archRes = ArchResults.create_from_state_dict(xdata['full']) # load trials trained with 200 epochs
print(archRes.arch_idx_str()) # print the index of this architecture
print(archRes.get_dataset_names()) # print the supported training data
print(archRes.get_compute_costs('cifar10-valid')) # print all computational info when training on cifar10-valid
print(archRes.get_metrics('cifar10-valid', 'x-valid', None, False)) # print the average loss/accuracy/time on all trials
print(archRes.get_metrics('cifar10-valid', 'x-valid', None, True)) # print loss/accuracy/time of a randomly selected trial
NASBench201API
는 최상위 레벨 API입니다. 다음 사용법을 참조하십시오.
from nas_201_api import NASBench201API as API
api = API('NAS-Bench-201-v1_1-096897.pth') # This will load all the information of NAS-Bench-201 except the trained weights
api = API('{:}/{:}'.format(os.environ['TORCH_HOME'], 'NAS-Bench-201-v1_1-096897.pth')) # The same as the above line while I usually save NAS-Bench-201-v1_1-096897.pth in ~/.torch/.
api.show(-1) # show info of all architectures
api.reload('{:}/{:}'.format(os.environ['TORCH_HOME'], 'NAS-BENCH-201-4-v1.0-archive'), 3) # This code will reload the information 3-th architecture with the trained weights
weights = api.get_net_param(3, 'cifar10', None) # Obtaining the weights of all trials for the 3-th architecture on cifar10. It will returns a dict, where the key is the seed and the value is the trained weights.
교육 및 평가 정보를 얻으려면 (여기에 의견을 참조하십시오) :
api.get_more_info(112, 'cifar10', None, hp='200', is_random=True)
# Query info of last training epoch for 112-th architecture
# using 200-epoch-hyper-parameter and randomly select a trial.
api.get_more_info(112, 'ImageNet16-120', None, hp='200', is_random=True)
NAS-Bench-2010이 연구에 도움이된다는 것을 알게되면 다음과 같은 인용을 고려하십시오.
@inproceedings{dong2020nasbench201,
title = {NAS-Bench-201: Extending the Scope of Reproducible Neural Architecture Search},
author = {Dong, Xuanyi and Yang, Yi},
booktitle = {International Conference on Learning Representations (ICLR)},
url = {https://openreview.net/forum?id=HJxyZkBKDr},
year = {2020}
}