เนื่องจาก NAS-Bench-201 ของเราได้ถูกขยายไปยัง Nats-Bench repo นี้เลิกใช้แล้วและไม่ได้รับการดูแล โปรดใช้ Nats-Bench ซึ่งมีข้อมูลสถาปัตยกรรมมากกว่า 5 เท่าและ API ที่เร็วกว่า NAS-Bench-201
เราเสนอเกณฑ์มาตรฐาน NAS อัลกอริทึม (NAS-BENCH-201) ด้วยพื้นที่ค้นหาคงที่ซึ่งให้เกณฑ์มาตรฐานแบบครบวงจรสำหรับอัลกอริทึม NAS ที่ทันสมัยเกือบทุกอัลกอริทึม การออกแบบพื้นที่การค้นหาของเราได้รับแรงบันดาลใจจากที่ใช้ในอัลกอริทึมการค้นหาที่ใช้เซลล์ยอดนิยมมากที่สุดซึ่งเซลล์จะถูกแสดงเป็นกราฟอะคิลลิคโดยตรง แต่ละขอบที่นี่เชื่อมโยงกับการดำเนินการที่เลือกจากชุดการดำเนินการที่กำหนดไว้ล่วงหน้า เพื่อให้สามารถใช้งานได้สำหรับอัลกอริทึม NAS ทั้งหมดพื้นที่การค้นหาที่กำหนดไว้ใน NAS-Bench-201 รวม 4 โหนดและ 5 ตัวเลือกการดำเนินการที่เกี่ยวข้องซึ่งสร้างผู้สมัครเซลล์ประสาท 15,625 คนทั้งหมด
ในไฟล์ markdown นี้เรามี:
สำหรับสองสิ่งต่อไปนี้โปรดใช้โครงการอัตโนมัติ:
หมายเหตุ: โปรดใช้ PyTorch >= 1.2.0
และ Python >= 3.6.0
คุณสามารถพิมพ์ pip install nas-bench-201
เพื่อติดตั้ง API ของเรา โปรดดูซอร์สโค้ดของโมดูล nas-bench-201
ใน repo นี้
หากคุณมีคำถามหรือปัญหาใด ๆ โปรดโพสต์ที่นี่หรือส่งอีเมลถึงฉัน
[เลิกใช้แล้ว] ไฟล์เกณฑ์มาตรฐาน เก่า ของ NAS-BENCH-201 สามารถดาวน์โหลดได้จาก Google Drive หรือ Baidu-Wangpan (รหัส: 6U5D)
[แนะนำ] ไฟล์เกณฑ์มาตรฐาน ล่าสุด ของ NAS-BENCH-201 ( NAS-Bench-201-v1_1-096897.pth
) สามารถดาวน์โหลดได้จาก Google Drive ไฟล์สำหรับน้ำหนักรุ่นมีขนาดใหญ่เกินไป (431G) และฉันต้องใช้เวลาในการอัปโหลด โปรดอดทนขอบคุณสำหรับความเข้าใจ
คุณสามารถย้ายไปยังที่ใดก็ได้ที่คุณต้องการและส่งเส้นทางไปยัง API ของเราเพื่อเริ่มต้น
NAS-Bench-201-v1_0-e61699.pth
(2.2G) โดยที่ e61699
เป็นตัวเลขหกหลักสุดท้ายสำหรับไฟล์นี้ มันมีข้อมูลทั้งหมดยกเว้นน้ำหนักที่ผ่านการฝึกอบรมของการทดลองแต่ละครั้งNAS-Bench-201-v1_1-096897.pth
(4.7G) โดยที่ 096897
เป็นตัวเลขหกหลักสุดท้ายสำหรับไฟล์นี้ มันมีข้อมูลของการทดลองมากขึ้นเมื่อเทียบกับ NAS-Bench-201-v1_0-e61699.pth
โดยเฉพาะทุกรุ่นที่ได้รับการฝึกฝนโดย 12 EPOCHS ในชุดข้อมูลทั้งหมดนั้นมีความสามารถ เราขอแนะนำให้ใช้ NAS-Bench-201-v1_1-096897.pth
ข้อมูลการฝึกอบรมและการประเมินผลที่ใช้ใน NAS-Bench-201 สามารถดาวน์โหลดได้จาก Google Drive หรือ Baidu-Wangpan (รหัส: 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
เก็บรักษาข้อมูลทั้งหมดของการทดลองใช้เฉพาะ หนึ่งสามารถสร้างอินสแตนซ์ ResultsCount และรับข้อมูลผ่านรหัสต่อไปนี้ ( 000157-FULL.pth
บันทึกข้อมูลทั้งหมดของการทดลองทั้งหมดของสถาปัตยกรรม 157-th):
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-201 ช่วยวิจัยของคุณโปรดพิจารณาอ้างว่า:
@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}
}