Reformulate via black

This commit is contained in:
D-X-Y
2021-03-17 09:25:58 +00:00
parent a9093e41e1
commit f98edea22a
59 changed files with 12289 additions and 8918 deletions

View File

@@ -5,35 +5,37 @@
################################################################################################
import sys, argparse
from pathlib import Path
lib_dir = (Path(__file__).parent / '..' / '..' / 'lib').resolve()
if str(lib_dir) not in sys.path: sys.path.insert(0, str(lib_dir))
from nas_201_api import NASBench201API as API
if __name__ == '__main__':
parser = argparse.ArgumentParser("Analysis of NAS-Bench-201")
parser.add_argument('--api_path', type=str, default=None, help='The path to the NAS-Bench-201 benchmark file.')
args = parser.parse_args()
lib_dir = (Path(__file__).parent / ".." / ".." / "lib").resolve()
if str(lib_dir) not in sys.path:
sys.path.insert(0, str(lib_dir))
from nas_201_api import NASBench201API as API
meta_file = Path(args.api_path)
assert meta_file.exists(), 'invalid path for api : {:}'.format(meta_file)
if __name__ == "__main__":
parser = argparse.ArgumentParser("Analysis of NAS-Bench-201")
parser.add_argument("--api_path", type=str, default=None, help="The path to the NAS-Bench-201 benchmark file.")
args = parser.parse_args()
api = API(str(meta_file))
meta_file = Path(args.api_path)
assert meta_file.exists(), "invalid path for api : {:}".format(meta_file)
# This will show the results of the best architecture based on the validation set of each dataset.
arch_index, accuracy = api.find_best('cifar10-valid', 'x-valid', None, None, False)
print('FOR CIFAR-010, using the hyper-parameters with 200 training epochs :::')
print('arch-index={:5d}, arch={:}'.format(arch_index, api.arch(arch_index)))
api.show(arch_index)
print('')
api = API(str(meta_file))
arch_index, accuracy = api.find_best('cifar100', 'x-valid', None, None, False)
print('FOR CIFAR-100, using the hyper-parameters with 200 training epochs :::')
print('arch-index={:5d}, arch={:}'.format(arch_index, api.arch(arch_index)))
api.show(arch_index)
print('')
# This will show the results of the best architecture based on the validation set of each dataset.
arch_index, accuracy = api.find_best("cifar10-valid", "x-valid", None, None, False)
print("FOR CIFAR-010, using the hyper-parameters with 200 training epochs :::")
print("arch-index={:5d}, arch={:}".format(arch_index, api.arch(arch_index)))
api.show(arch_index)
print("")
arch_index, accuracy = api.find_best('ImageNet16-120', 'x-valid', None, None, False)
print('FOR ImageNet16-120, using the hyper-parameters with 200 training epochs :::')
print('arch-index={:5d}, arch={:}'.format(arch_index, api.arch(arch_index)))
api.show(arch_index)
print('')
arch_index, accuracy = api.find_best("cifar100", "x-valid", None, None, False)
print("FOR CIFAR-100, using the hyper-parameters with 200 training epochs :::")
print("arch-index={:5d}, arch={:}".format(arch_index, api.arch(arch_index)))
api.show(arch_index)
print("")
arch_index, accuracy = api.find_best("ImageNet16-120", "x-valid", None, None, False)
print("FOR ImageNet16-120, using the hyper-parameters with 200 training epochs :::")
print("arch-index={:5d}, arch={:}".format(arch_index, api.arch(arch_index)))
api.show(arch_index)
print("")