Update NATS-Bench (sss version 1.2)
This commit is contained in:
		| @@ -11,7 +11,6 @@ | ||||
| # python exps/NATS-Bench/sss-collect.py                                      # | ||||
| ############################################################################## | ||||
| import os, re, sys, time, shutil, argparse, collections | ||||
| import numpy as np | ||||
| import torch | ||||
| from tqdm import tqdm | ||||
| from pathlib import Path | ||||
| @@ -22,7 +21,7 @@ if str(lib_dir) not in sys.path: sys.path.insert(0, str(lib_dir)) | ||||
| from log_utils    import AverageMeter, time_string, convert_secs2time | ||||
| from config_utils import dict2config | ||||
| from models       import CellStructure, get_cell_based_tiny_net | ||||
| from nas_201_api  import ArchResults, ResultsCount | ||||
| from nats_bench   import pickle_save, pickle_load, ArchResults, ResultsCount | ||||
| from procedures   import bench_pure_evaluate as pure_evaluate, get_nas_bench_loaders | ||||
| from utils        import get_md5_file | ||||
|  | ||||
| @@ -193,8 +192,8 @@ def simplify(save_dir, save_name, nets, total): | ||||
|     arch_str = nets[index] | ||||
|     hp2info = OrderedDict() | ||||
|  | ||||
|     full_save_path = full_save_dir / '{:06d}.npy'.format(index) | ||||
|     simple_save_path = simple_save_dir / '{:06d}.npy'.format(index) | ||||
|     full_save_path = full_save_dir / '{:06d}.pickle'.format(index) | ||||
|     simple_save_path = simple_save_dir / '{:06d}.pickle'.format(index) | ||||
|  | ||||
|     for hp in hps: | ||||
|       sub_save_dir = save_dir / 'raw-data-{:}'.format(hp) | ||||
| @@ -213,13 +212,13 @@ def simplify(save_dir, save_name, nets, total): | ||||
|     to_save_data = OrderedDict({'01': hp2info['01'].state_dict(), | ||||
|                                 '12': hp2info['12'].state_dict(), | ||||
|                                 '90': hp2info['90'].state_dict()}) | ||||
|     np.save(str(full_save_path), to_save_data) | ||||
|     pickle_save(to_save_data, str(full_save_path)) | ||||
|      | ||||
|     for hp in hps: hp2info[hp].clear_params() | ||||
|     to_save_data = OrderedDict({'01': hp2info['01'].state_dict(), | ||||
|                                 '12': hp2info['12'].state_dict(), | ||||
|                                 '90': hp2info['90'].state_dict()}) | ||||
|     np.save(str(simple_save_path), to_save_data) | ||||
|     pickle_save(to_save_data, str(simple_save_path)) | ||||
|     arch2infos[index] = to_save_data | ||||
|     # measure elapsed time | ||||
|     arch_time.update(time.time() - end_time) | ||||
| @@ -231,18 +230,23 @@ def simplify(save_dir, save_name, nets, total): | ||||
|                  'total_archs': total, | ||||
|                  'arch2infos' : arch2infos, | ||||
|                  'evaluated_indexes': evaluated_indexes} | ||||
|   save_file_name = save_dir / '{:}.npy'.format(save_name) | ||||
|   np.save(str(save_file_name), final_infos) | ||||
|   save_file_name = save_dir / '{:}.pickle'.format(save_name) | ||||
|   pickle_save(final_infos, str(save_file_name)) | ||||
|   # move the benchmark file to a new path | ||||
|   hd5sum = get_md5_file(save_file_name) | ||||
|   hd5_file_name = save_dir / '{:}-{:}.npy'.format(NATS_TSS_BASE_NAME, hd5sum) | ||||
|   shutil.move(save_file_name, hd5_file_name) | ||||
|   hd5sum = get_md5_file(str(save_file_name) + '.pbz2') | ||||
|   hd5_file_name = save_dir / '{:}-{:}.pickle.pbz2'.format(NATS_TSS_BASE_NAME, hd5sum) | ||||
|   shutil.move(str(save_file_name) + '.pbz2', hd5_file_name) | ||||
|   print('Save {:} / {:} architecture results into {:} -> {:}.'.format(len(evaluated_indexes), total, save_file_name, hd5_file_name)) | ||||
|   # move the directory to a new path | ||||
|   hd5_full_save_dir = save_dir / '{:}-{:}-full'.format(NATS_TSS_BASE_NAME, hd5sum) | ||||
|   hd5_simple_save_dir = save_dir / '{:}-{:}-simple'.format(NATS_TSS_BASE_NAME, hd5sum) | ||||
|   shutil.move(full_save_dir, hd5_full_save_dir) | ||||
|   shutil.move(simple_save_dir, hd5_simple_save_dir) | ||||
|   # save the meta information for simple and full | ||||
|   final_infos['arch2infos'] = None | ||||
|   final_infos['evaluated_indexes'] = set() | ||||
|   pickle_save(final_infos, str(hd5_full_save_dir / 'meta.pickle')) | ||||
|   pickle_save(final_infos, str(hd5_simple_save_dir / 'meta.pickle')) | ||||
|  | ||||
|  | ||||
| def traverse_net(candidates: List[int], N: int): | ||||
|   | ||||
| @@ -1,12 +1,10 @@ | ||||
| ############################################################### | ||||
| # NAS-Bench-201, ICLR 2020 (https://arxiv.org/abs/2001.00326) # | ||||
| ############################################################### | ||||
| # NATS-Bench: Benchmarking NAS algorithms for Architecture Topology and Size | ||||
| ############################################################### | ||||
| # Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2020.06           # | ||||
| ############################################################### | ||||
| # Usage: python exps/NAS-Bench-201/test-nas-api.py            # | ||||
| ############################################################### | ||||
| ############################################################################## | ||||
| # NATS-Bench: Benchmarking NAS algorithms for Architecture Topology and Size # | ||||
| ############################################################################## | ||||
| # Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2020.08                          # | ||||
| ############################################################################## | ||||
| # Usage: python exps/NATS-Bench/test-nats-api.py                             # | ||||
| ############################################################################## | ||||
| import os, sys, time, torch, argparse | ||||
| import numpy as np | ||||
| from typing import List, Text, Dict, Any | ||||
| @@ -61,10 +59,12 @@ def test_api(api, is_301=True): | ||||
|   print('{:}\n'.format(info)) | ||||
|   info = api.get_latency(12, 'cifar10') | ||||
|   print('{:}\n'.format(info)) | ||||
|   for index in [13, 15, 19, 200]: | ||||
|     info = api.get_latency(index, 'cifar10') | ||||
| 
 | ||||
|   # Count the number of architectures | ||||
|   info = api.statistics('cifar100', '12') | ||||
|   print('{:}\n'.format(info)) | ||||
|   print('{:} statistics results : {:}\n'.format(time_string(), info)) | ||||
| 
 | ||||
|   # Show the information of the 123-th architecture | ||||
|   api.show(123) | ||||
| @@ -80,33 +80,18 @@ def test_api(api, is_301=True): | ||||
|     print('Compute the adjacency matrix of {:}'.format(arch_str)) | ||||
|     print(matrix) | ||||
|   info = api.simulate_train_eval(123, 'cifar10') | ||||
|   print('simulate_train_eval : {:}'.format(info)) | ||||
| 
 | ||||
| 
 | ||||
| def test_issue_81_82(api): | ||||
|   results = api.query_by_index(0, 'cifar10-valid', hp='12') | ||||
|   results = api.query_by_index(0, 'cifar10-valid', hp='200') | ||||
|   print(list(results.keys())) | ||||
|   print(results[888].get_eval('valid')) | ||||
|   print(results[888].get_eval('x-valid')) | ||||
|   result_dict = api.get_more_info(index=0, dataset='cifar10-valid', iepoch=11, hp='200', is_random=False) | ||||
|   info = api.query_by_arch('|nor_conv_3x3~0|+|skip_connect~0|nor_conv_3x3~1|+|skip_connect~0|none~1|nor_conv_3x3~2|', '200') | ||||
|   print(info) | ||||
|   structure = CellStructure.str2structure('|nor_conv_3x3~0|+|skip_connect~0|nor_conv_3x3~1|+|skip_connect~0|none~1|nor_conv_3x3~2|') | ||||
|   info = api.query_by_arch(structure, '200') | ||||
|   print(info) | ||||
|   print('simulate_train_eval : {:}\n\n'.format(info)) | ||||
| 
 | ||||
| 
 | ||||
| if __name__ == '__main__': | ||||
| 
 | ||||
|   api201 = create(os.path.join(os.environ['TORCH_HOME'], 'NAS-Bench-201-v1_0-e61699.pth'), 'topology', True) | ||||
|   test_issue_81_82(api201) | ||||
|   print ('Test {:} done'.format(api201)) | ||||
|   for fast_mode in [True, False]: | ||||
|     for verbose in [True, False]: | ||||
|       print('{:} create with fast_mode={:} and verbose={:}'.format(time_string(), fast_mode, verbose)) | ||||
|       api301 = create(None, 'size', fast_mode=fast_mode, verbose=True) | ||||
|       print('{:} --->>> {:}'.format(time_string(), api301)) | ||||
|       test_api(api301, True) | ||||
| 
 | ||||
|   api201 = create(None, 'topology', True)  # use the default file path | ||||
|   test_issue_81_82(api201) | ||||
|   test_api(api201, False) | ||||
|   print ('Test {:} done'.format(api201)) | ||||
| 
 | ||||
|   api301 = create(None, 'size', True) | ||||
|   test_api(api301, True) | ||||
|   # api201 = create(None, 'topology', True)  # use the default file path | ||||
|   # test_api(api201, False) | ||||
|   # print ('Test {:} done'.format(api201)) | ||||
| @@ -5,8 +5,8 @@ | ||||
| # required to install hpbandster ################################## | ||||
| # pip install hpbandster         ################################## | ||||
| ################################################################### | ||||
| # OMP_NUM_THREADS=4 python exps/algos-v2/bohb.py --search_space tss --dataset cifar10 --num_samples 4 --random_fraction 0.0 --bandwidth_factor 3 --rand_seed 1 | ||||
| # OMP_NUM_THREADS=4 python exps/algos-v2/bohb.py --search_space sss --dataset cifar10 --num_samples 4 --random_fraction 0.0 --bandwidth_factor 3 --rand_seed 1 | ||||
| # OMP_NUM_THREADS=4 python exps/NATS-algos/bohb.py --search_space tss --dataset cifar10 --num_samples 4 --random_fraction 0.0 --bandwidth_factor 3 --rand_seed 1 | ||||
| # OMP_NUM_THREADS=4 python exps/NATS-algos/bohb.py --search_space sss --dataset cifar10 --num_samples 4 --random_fraction 0.0 --bandwidth_factor 3 --rand_seed 1 | ||||
| ################################################################### | ||||
| import os, sys, time, random, argparse, collections | ||||
| from copy import deepcopy | ||||
| @@ -167,7 +167,7 @@ if __name__ == '__main__': | ||||
|   parser.add_argument('--rand_seed',          type=int,  default=-1, help='manual seed') | ||||
|   args = parser.parse_args() | ||||
|    | ||||
|   api = create(None, args.search_space, verbose=False) | ||||
|   api = create(None, args.search_space, fast_mode=True, verbose=False) | ||||
| 
 | ||||
|   args.save_dir = os.path.join('{:}-{:}'.format(args.save_dir, args.search_space), args.dataset, 'BOHB') | ||||
|   print('save-dir : {:}'.format(args.save_dir)) | ||||
| @@ -3,9 +3,9 @@ | ||||
| ############################################################################## | ||||
| # Random Search for Hyper-Parameter Optimization, JMLR 2012 ################## | ||||
| ############################################################################## | ||||
| # python ./exps/algos-v2/random_wo_share.py --dataset cifar10 --search_space tss | ||||
| # python ./exps/algos-v2/random_wo_share.py --dataset cifar100 --search_space tss | ||||
| # python ./exps/algos-v2/random_wo_share.py --dataset ImageNet16-120 --search_space tss | ||||
| # python ./exps/NATS-algos/random_wo_share.py --dataset cifar10 --search_space tss | ||||
| # python ./exps/NATS-algos/random_wo_share.py --dataset cifar100 --search_space tss | ||||
| # python ./exps/NATS-algos/random_wo_share.py --dataset ImageNet16-120 --search_space tss | ||||
| ############################################################################## | ||||
| import os, sys, time, glob, random, argparse | ||||
| import numpy as np, collections | ||||
| @@ -71,7 +71,7 @@ if __name__ == '__main__': | ||||
|   parser.add_argument('--rand_seed',          type=int,   default=-1,    help='manual seed') | ||||
|   args = parser.parse_args() | ||||
|    | ||||
|   api = create(None, args.search_space, verbose=False) | ||||
|   api = create(None, args.search_space, fast_mode=True, verbose=False) | ||||
| 
 | ||||
|   args.save_dir = os.path.join('{:}-{:}'.format(args.save_dir, args.search_space), args.dataset, 'RANDOM') | ||||
|   print('save-dir : {:}'.format(args.save_dir)) | ||||
| @@ -3,12 +3,12 @@ | ||||
| ################################################################## | ||||
| # Regularized Evolution for Image Classifier Architecture Search # | ||||
| ################################################################## | ||||
| # python ./exps/algos-v2/regularized_ea.py --dataset cifar10 --search_space tss --ea_cycles 200 --ea_population 10 --ea_sample_size 3 --rand_seed 1 | ||||
| # python ./exps/algos-v2/regularized_ea.py --dataset cifar100 --search_space tss --ea_cycles 200 --ea_population 10 --ea_sample_size 3 --rand_seed 1 | ||||
| # python ./exps/algos-v2/regularized_ea.py --dataset ImageNet16-120 --search_space tss --ea_cycles 200 --ea_population 10 --ea_sample_size 3 --rand_seed 1 | ||||
| # python ./exps/algos-v2/regularized_ea.py --dataset cifar10 --search_space sss --ea_cycles 200 --ea_population 10 --ea_sample_size 3 --rand_seed 1 | ||||
| # python ./exps/algos-v2/regularized_ea.py --dataset cifar100 --search_space sss --ea_cycles 200 --ea_population 10 --ea_sample_size 3 --rand_seed 1 | ||||
| # python ./exps/algos-v2/regularized_ea.py --dataset ImageNet16-120 --search_space sss --ea_cycles 200 --ea_population 10 --ea_sample_size 3 --rand_seed 1 | ||||
| # python ./exps/NATS-algos/regularized_ea.py --dataset cifar10 --search_space tss --ea_cycles 200 --ea_population 10 --ea_sample_size 3 --rand_seed 1 | ||||
| # python ./exps/NATS-algos/regularized_ea.py --dataset cifar100 --search_space tss --ea_cycles 200 --ea_population 10 --ea_sample_size 3 --rand_seed 1 | ||||
| # python ./exps/NATS-algos/regularized_ea.py --dataset ImageNet16-120 --search_space tss --ea_cycles 200 --ea_population 10 --ea_sample_size 3 --rand_seed 1 | ||||
| # python ./exps/NATS-algos/regularized_ea.py --dataset cifar10 --search_space sss --ea_cycles 200 --ea_population 10 --ea_sample_size 3 --rand_seed 1 | ||||
| # python ./exps/NATS-algos/regularized_ea.py --dataset cifar100 --search_space sss --ea_cycles 200 --ea_population 10 --ea_sample_size 3 --rand_seed 1 | ||||
| # python ./exps/NATS-algos/regularized_ea.py --dataset ImageNet16-120 --search_space sss --ea_cycles 200 --ea_population 10 --ea_sample_size 3 --rand_seed 1 | ||||
| ################################################################## | ||||
| import os, sys, time, glob, random, argparse | ||||
| import numpy as np, collections | ||||
| @@ -198,7 +198,7 @@ if __name__ == '__main__': | ||||
|   parser.add_argument('--rand_seed',          type=int,   default=-1,    help='manual seed') | ||||
|   args = parser.parse_args() | ||||
| 
 | ||||
|   api = create(None, args.search_space, verbose=False) | ||||
|   api = create(None, args.search_space, fast_mode=True, verbose=False) | ||||
| 
 | ||||
|   args.save_dir = os.path.join('{:}-{:}'.format(args.save_dir, args.search_space), args.dataset, 'R-EA-SS{:}'.format(args.ea_sample_size)) | ||||
|   print('save-dir : {:}'.format(args.save_dir)) | ||||
| @@ -3,12 +3,12 @@ | ||||
| ##################################################################################################### | ||||
| # modified from https://github.com/pytorch/examples/blob/master/reinforcement_learning/reinforce.py # | ||||
| ##################################################################################################### | ||||
| # python ./exps/algos-v2/reinforce.py --dataset cifar10 --search_space tss --learning_rate 0.01  | ||||
| # python ./exps/algos-v2/reinforce.py --dataset cifar100 --search_space tss --learning_rate 0.01  | ||||
| # python ./exps/algos-v2/reinforce.py --dataset ImageNet16-120 --search_space tss --learning_rate 0.01  | ||||
| # python ./exps/algos-v2/reinforce.py --dataset cifar10 --search_space sss --learning_rate 0.01  | ||||
| # python ./exps/algos-v2/reinforce.py --dataset cifar100 --search_space sss --learning_rate 0.01  | ||||
| # python ./exps/algos-v2/reinforce.py --dataset ImageNet16-120 --search_space sss --learning_rate 0.01  | ||||
| # python ./exps/NATS-algos/reinforce.py --dataset cifar10 --search_space tss --learning_rate 0.01  | ||||
| # python ./exps/NATS-algos/reinforce.py --dataset cifar100 --search_space tss --learning_rate 0.01  | ||||
| # python ./exps/NATS-algos/reinforce.py --dataset ImageNet16-120 --search_space tss --learning_rate 0.01  | ||||
| # python ./exps/NATS-algos/reinforce.py --dataset cifar10 --search_space sss --learning_rate 0.01  | ||||
| # python ./exps/NATS-algos/reinforce.py --dataset cifar100 --search_space sss --learning_rate 0.01  | ||||
| # python ./exps/NATS-algos/reinforce.py --dataset ImageNet16-120 --search_space sss --learning_rate 0.01  | ||||
| ##################################################################################################### | ||||
| import os, sys, time, glob, random, argparse | ||||
| import numpy as np, collections | ||||
							
								
								
									
										47
									
								
								exps/NATS-algos/run-all.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								exps/NATS-algos/run-all.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | ||||
| #!/bin/bash | ||||
| # bash ./exps/NATS-algos/run-all.sh mul | ||||
| # bash ./exps/NATS-algos/run-all.sh ws | ||||
| set -e | ||||
| echo script name: $0 | ||||
| echo $# arguments | ||||
| if [ "$#" -ne 1 ] ;then | ||||
|   echo "Input illegal number of parameters " $# | ||||
|   echo "Need 1 parameters for type of algorithms." | ||||
|   exit 1 | ||||
| fi | ||||
|  | ||||
|  | ||||
| datasets="cifar10 cifar100 ImageNet16-120" | ||||
| alg_type=$1 | ||||
|  | ||||
| if [ "$alg_type" == "mul" ]; then | ||||
|   search_spaces="tss sss" | ||||
|  | ||||
|   for dataset in ${datasets} | ||||
|   do | ||||
|     for search_space in ${search_spaces} | ||||
|     do | ||||
|       python ./exps/NATS-algos/reinforce.py --dataset ${dataset} --search_space ${search_space} --learning_rate 0.01 | ||||
|       python ./exps/NATS-algos/regularized_ea.py --dataset ${dataset} --search_space ${search_space} --ea_cycles 200 --ea_population 10 --ea_sample_size 3 | ||||
|       python ./exps/NATS-algos/random_wo_share.py --dataset ${dataset} --search_space ${search_space} | ||||
|       python ./exps/NATS-algos/bohb.py --dataset ${dataset} --search_space ${search_space} --num_samples 4 --random_fraction 0.0 --bandwidth_factor 3 | ||||
|     done | ||||
|   done | ||||
|  | ||||
|   python exps/experimental/vis-bench-algos.py --search_space tss | ||||
|   python exps/experimental/vis-bench-algos.py --search_space sss | ||||
| else | ||||
|   seeds="777 888 999" | ||||
|   algos="darts-v1 darts-v2 gdas setn random enas" | ||||
|   epoch=200 | ||||
|   for seed in ${seeds} | ||||
|   do | ||||
|     for alg in ${algos} | ||||
|     do | ||||
|       python ./exps/NATS-algos/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo ${alg} --rand_seed ${seed} --overwite_epochs ${epoch} | ||||
|       python ./exps/NATS-algos/search-cell.py --dataset cifar100  --data_path $TORCH_HOME/cifar.python --algo ${alg} --rand_seed ${seed} --overwite_epochs ${epoch} | ||||
|       python ./exps/NATS-algos/search-cell.py --dataset ImageNet16-120  --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo ${alg} --rand_seed ${seed} --overwite_epochs ${epoch} | ||||
|     done | ||||
|   done | ||||
| fi | ||||
|  | ||||
| @@ -1,29 +1,29 @@ | ||||
| ################################################## | ||||
| # Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2020 # | ||||
| ###################################################################################### | ||||
| # python ./exps/algos-v2/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo darts-v1 --rand_seed 777 | ||||
| # python ./exps/algos-v2/search-cell.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo darts-v1 --drop_path_rate 0.3 | ||||
| # python ./exps/algos-v2/search-cell.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo darts-v1 | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo darts-v1 --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo darts-v1 --drop_path_rate 0.3 | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo darts-v1 | ||||
| #### | ||||
| # python ./exps/algos-v2/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo darts-v2 --rand_seed 777 | ||||
| # python ./exps/algos-v2/search-cell.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo darts-v2 | ||||
| # python ./exps/algos-v2/search-cell.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo darts-v2 | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo darts-v2 --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo darts-v2 | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo darts-v2 | ||||
| #### | ||||
| # python ./exps/algos-v2/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo gdas --rand_seed 777 | ||||
| # python ./exps/algos-v2/search-cell.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo gdas | ||||
| # python ./exps/algos-v2/search-cell.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo gdas | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo gdas --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo gdas | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo gdas | ||||
| #### | ||||
| # python ./exps/algos-v2/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo setn --rand_seed 777 | ||||
| # python ./exps/algos-v2/search-cell.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo setn | ||||
| # python ./exps/algos-v2/search-cell.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo setn | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo setn --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo setn | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo setn | ||||
| #### | ||||
| # python ./exps/algos-v2/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo random --rand_seed 777 | ||||
| # python ./exps/algos-v2/search-cell.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo random | ||||
| # python ./exps/algos-v2/search-cell.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo random | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo random --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo random | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo random | ||||
| #### | ||||
| # python ./exps/algos-v2/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo enas --arch_weight_decay 0 --arch_learning_rate 0.001 --arch_eps 0.001 --rand_seed 777 | ||||
| # python ./exps/algos-v2/search-cell.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo enas --arch_weight_decay 0 --arch_learning_rate 0.001 --arch_eps 0.001 --rand_seed 777 | ||||
| # python ./exps/algos-v2/search-cell.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo enas --arch_weight_decay 0 --arch_learning_rate 0.001 --arch_eps 0.001 --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo enas --arch_weight_decay 0 --arch_learning_rate 0.001 --arch_eps 0.001 --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo enas --arch_weight_decay 0 --arch_learning_rate 0.001 --arch_eps 0.001 --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-cell.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo enas --arch_weight_decay 0 --arch_learning_rate 0.001 --arch_eps 0.001 --rand_seed 777 | ||||
| ###################################################################################### | ||||
| import os, sys, time, random, argparse | ||||
| import numpy as np | ||||
| @@ -364,7 +364,7 @@ def main(xargs): | ||||
|   logger.log('The parameters of the search model = {:.2f} MB'.format(params)) | ||||
|   logger.log('search-space : {:}'.format(search_space)) | ||||
|   if bool(xargs.use_api): | ||||
|     api = create(None, 'topology', verbose=False) | ||||
|     api = create(None, 'topology', fast_mode=True, verbose=False) | ||||
|   else: | ||||
|     api = None | ||||
|   logger.log('{:} create API = {:} done'.format(time_string(), api)) | ||||
| @@ -1,17 +1,17 @@ | ||||
| ################################################## | ||||
| # Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2020 # | ||||
| ###################################################################################### | ||||
| # python ./exps/algos-v2/search-size.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo tas --rand_seed 777 | ||||
| # python ./exps/algos-v2/search-size.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo tas --rand_seed 777 | ||||
| # python ./exps/algos-v2/search-size.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo tas --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-size.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo tas --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-size.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo tas --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-size.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo tas --rand_seed 777 | ||||
| #### | ||||
| # python ./exps/algos-v2/search-size.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo fbv2 --rand_seed 777 | ||||
| # python ./exps/algos-v2/search-size.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo fbv2 --rand_seed 777 | ||||
| # python ./exps/algos-v2/search-size.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo fbv2 --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-size.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo fbv2 --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-size.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo fbv2 --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-size.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo fbv2 --rand_seed 777 | ||||
| #### | ||||
| # python ./exps/algos-v2/search-size.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo tunas --arch_weight_decay 0 --rand_seed 777 --use_api 0 | ||||
| # python ./exps/algos-v2/search-size.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo tunas --arch_weight_decay 0 --rand_seed 777 | ||||
| # python ./exps/algos-v2/search-size.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo tunas --arch_weight_decay 0 --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-size.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo tunas --arch_weight_decay 0 --rand_seed 777 --use_api 0 | ||||
| # python ./exps/NATS-algos/search-size.py --dataset cifar100 --data_path $TORCH_HOME/cifar.python --algo tunas --arch_weight_decay 0 --rand_seed 777 | ||||
| # python ./exps/NATS-algos/search-size.py --dataset ImageNet16-120 --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo tunas --arch_weight_decay 0 --rand_seed 777 | ||||
| ###################################################################################### | ||||
| import os, sys, time, random, argparse | ||||
| import numpy as np | ||||
| @@ -176,7 +176,7 @@ def main(xargs): | ||||
|   logger.log('The parameters of the search model = {:.2f} MB'.format(params)) | ||||
|   logger.log('search-space : {:}'.format(search_space)) | ||||
|   if bool(xargs.use_api): | ||||
|     api = create(None, 'size', verbose=False) | ||||
|     api = create(None, 'size', fast_mode=True, verbose=False) | ||||
|   else: | ||||
|     api = None | ||||
|   logger.log('{:} create API = {:} done'.format(time_string(), api)) | ||||
| @@ -1,47 +0,0 @@ | ||||
| #!/bin/bash | ||||
| # bash ./exps/algos-v2/run-all.sh mul | ||||
| # bash ./exps/algos-v2/run-all.sh ws | ||||
| set -e | ||||
| echo script name: $0 | ||||
| echo $# arguments | ||||
| if [ "$#" -ne 1 ] ;then | ||||
|   echo "Input illegal number of parameters " $# | ||||
|   echo "Need 1 parameters for type of algorithms." | ||||
|   exit 1 | ||||
| fi | ||||
|  | ||||
|  | ||||
| datasets="cifar10 cifar100 ImageNet16-120" | ||||
| alg_type=$1 | ||||
|  | ||||
| if [ "$alg_type" == "mul" ]; then | ||||
|   search_spaces="tss sss" | ||||
|  | ||||
|   for dataset in ${datasets} | ||||
|   do | ||||
|     for search_space in ${search_spaces} | ||||
|     do | ||||
|       python ./exps/algos-v2/reinforce.py --dataset ${dataset} --search_space ${search_space} --learning_rate 0.01 | ||||
|       python ./exps/algos-v2/regularized_ea.py --dataset ${dataset} --search_space ${search_space} --ea_cycles 200 --ea_population 10 --ea_sample_size 3 | ||||
|       python ./exps/algos-v2/random_wo_share.py --dataset ${dataset} --search_space ${search_space} | ||||
|       python ./exps/algos-v2/bohb.py --dataset ${dataset} --search_space ${search_space} --num_samples 4 --random_fraction 0.0 --bandwidth_factor 3 | ||||
|     done | ||||
|   done | ||||
|  | ||||
|   python exps/experimental/vis-bench-algos.py --search_space tss | ||||
|   python exps/experimental/vis-bench-algos.py --search_space sss | ||||
| else | ||||
|   seeds="777 888 999" | ||||
|   algos="darts-v1 darts-v2 gdas setn random enas" | ||||
|   epoch=200 | ||||
|   for seed in ${seeds} | ||||
|   do | ||||
|     for alg in ${algos} | ||||
|     do | ||||
|       python ./exps/algos-v2/search-cell.py --dataset cifar10  --data_path $TORCH_HOME/cifar.python --algo ${alg} --rand_seed ${seed} --overwite_epochs ${epoch} | ||||
|       python ./exps/algos-v2/search-cell.py --dataset cifar100  --data_path $TORCH_HOME/cifar.python --algo ${alg} --rand_seed ${seed} --overwite_epochs ${epoch} | ||||
|       python ./exps/algos-v2/search-cell.py --dataset ImageNet16-120  --data_path $TORCH_HOME/cifar.python/ImageNet16 --algo ${alg} --rand_seed ${seed} --overwite_epochs ${epoch} | ||||
|     done | ||||
|   done | ||||
| fi | ||||
|  | ||||
		Reference in New Issue
	
	Block a user