This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
NAS Benchmark #2578
Merged
Merged
NAS Benchmark #2578
Changes from 32 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
a233727
Adding NAS Benchmark (201)
ultmaster c0c8645
Add missing endline
ultmaster 21a93df
Update script
ultmaster b78877a
Draft for NAS-Bench-101
ultmaster 3fecdb1
Update NAS-Bench-101
ultmaster f0dc0b9
Update constants
ultmaster 435e47d
Add API
ultmaster c059045
Update API
ultmaster 44baec7
Fix typo
ultmaster 22123e1
Draft for NDS
ultmaster 6e25351
Fix issues in storing loss
ultmaster d5b7de1
Fix cell_spec problem
ultmaster 24f95e5
Finalize NDS
ultmaster 948822a
Update time consumption
ultmaster e654ff0
Add nds query function
ultmaster 3e73ee0
Update documentation for NAS-Bench-101
ultmaster 3d12bf8
Reformat generators
ultmaster 5412777
Add NAS-Bench-201 docs
ultmaster d4fc6e6
Unite constant names
ultmaster b75b619
Update docstring
ultmaster 67f66df
Update docstring
ultmaster 3eec48f
Update rst
ultmaster 984972a
Update scripts
ultmaster 9f9d851
Add git as dependency
ultmaster 6d7766a
Apt update
ultmaster a217023
Update installation scripts
ultmaster aea8cef
Fix dependency for pipeline
ultmaster 9022a8b
Fix NDS script
ultmaster 2f6da90
Fix NAS-Bench-201 installation
ultmaster aa66a6b
Add example notebook
ultmaster abb681a
Correct latency dimension
ultmaster a7b6c2e
Merge branch 'master' into nasbenchmark-2006
ultmaster 7f7a97c
shortcuts -> query
ultmaster bdd26cf
Merge branch 'nasbenchmark-2006' of github.com:ultmaster/nni into nas…
ultmaster 907dccb
Change run -> trial, ComputedStats -> TrialStats
ultmaster 2872ba2
ipynb needs re-generation
ultmaster 77e703c
Fix NAS rst
ultmaster 1f905c0
Fix documentation and pylint
ultmaster 197d308
Fix pylint
ultmaster f25f6bd
Add pandoc as dependency
ultmaster 6926d3e
Update pandoc dependency
ultmaster d91851d
Fix documentation broken link
ultmaster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
# NAS Benchmark (experimental) | ||
|
||
## Prerequisites | ||
|
||
* Please prepare a folder to household all the benchmark databases. By default, it can be found at `${HOME}/.nni/nasbenchmark`. You can place it anywhere you like, and specify it in `NASBENCHMARK_DIR` before importing NNI. | ||
* Please install `peewee` via `pip install peewee`, which NNI uses to connect to database. | ||
|
||
## Data Preparation | ||
|
||
To avoid storage and legal issues, we do not provide any prepared databases. We strongly recommend users to use docker to run the generation scripts, to ease the burden of installing multiple dependencies. Please follow the following steps. | ||
|
||
1. Clone NNI repo. Replace `${NNI_VERSION}` with a released version name or branch name, e.g., `v1.6`. | ||
|
||
```bash | ||
git clone -b ${NNI_VERSION} https://github.com/microsoft/nni | ||
``` | ||
|
||
2. Run docker. | ||
|
||
For NAS-Bench-101, | ||
|
||
```bash | ||
docker run -v ${HOME}/.nni/nasbenchmark:/outputs -v /path/to/your/nni:/nni tensorflow/tensorflow:1.15.2-py3 /bin/bash /nni/examples/nas/benchmark/nasbench101.sh | ||
``` | ||
|
||
For NAS-Bench-201, | ||
|
||
```bash | ||
docker run -v ${HOME}/.nni/nasbenchmark:/outputs -v /path/to/your/nni:/nni ufoym/deepo:pytorch-cpu /bin/bash /nni/examples/nas/benchmark/nasbench201.sh | ||
``` | ||
|
||
For NDS, | ||
|
||
```bash | ||
docker run -v ${HOME}/.nni/nasbenchmark:/outputs -v /path/to/your/nni:/nni python:3.7 /bin/bash /nni/examples/nas/benchmark/nds.sh | ||
``` | ||
|
||
Please make sure there is at least 10GB free disk space and note that the conversion process can take up to hours to complete. | ||
|
||
## NAS-Bench-101 | ||
|
||
[Paper link](https://arxiv.org/abs/1902.09635) [Open-source](https://github.com/google-research/nasbench) | ||
|
||
NAS-Bench-101 contains 423,624 unique neural networks, combined with 4 variations in number of epochs (4, 12, 36, 108), each of which is trained 3 times. It is a cell-wise search space, which constructs and stacks a cell by enumerating DAGs with at most 7 operators, and no more than 9 connections. All operators can be chosen from `CONV3X3_BN_RELU`, `CONV1X1_BN_RELU` and `MAXPOOL3X3`, except the first operator (always `INPUT`) and last operator (always `OUTPUT`). | ||
|
||
Notably, NAS-Bench-101 eliminates invalid cells (e.g., there is no path from input to output, or there is redundant computation). Furthermore, isomorphic cells are de-duplicated, i.e., all the remaining cells are computationally unique. | ||
|
||
### API Documentation | ||
|
||
```eval_rst | ||
.. autofunction:: nni.nas.benchmark.nasbench101.query_nb101_computed_stats | ||
|
||
.. autoattribute:: nni.nas.benchmark.nasbench101.INPUT | ||
|
||
.. autoattribute:: nni.nas.benchmark.nasbench101.OUTPUT | ||
|
||
.. autoattribute:: nni.nas.benchmark.nasbench101.CONV3X3_BN_RELU | ||
|
||
.. autoattribute:: nni.nas.benchmark.nasbench101.CONV1X1_BN_RELU | ||
|
||
.. autoattribute:: nni.nas.benchmark.nasbench101.MAXPOOL3X3 | ||
|
||
.. autoclass:: nni.nas.benchmark.nasbench101.Nb101RunConfig | ||
|
||
.. autoclass:: nni.nas.benchmark.nasbench101.Nb101ComputedStats | ||
|
||
.. autoclass:: nni.nas.benchmark.nasbench101.Nb101IntermediateStats | ||
|
||
.. autofunction:: nni.nas.benchmark.nasbench101.graph_util.nasbench_format_to_architecture_repr | ||
|
||
.. autofunction:: nni.nas.benchmark.nasbench101.graph_util.infer_num_vertices | ||
|
||
.. autofunction:: nni.nas.benchmark.nasbench101.graph_util.hash_module | ||
``` | ||
|
||
## NAS-Bench-201 | ||
|
||
[Paper link](https://arxiv.org/abs/2001.00326) [Open-source API](https://github.com/D-X-Y/NAS-Bench-201) [Implementations](https://github.com/D-X-Y/AutoDL-Projects) | ||
|
||
NAS-Bench-201 is a cell-wise search space that views nodes as tensors and edges as operators. The search space contains all possible densely-connected DAGs with 4 nodes, resulting in 15,625 candidates in total. Each operator (i.e., edge) is selected from a pre-defined operator set (`NONE`, `SKIP_CONNECT`, `CONV_1X1`, `CONV_3X3` and `AVG_POOL_3X3`). Training appraoches vary in the dataset used (CIFAR-10, CIFAR-100, ImageNet) and number of epochs scheduled (12 and 200). Each combination of architecture and training approach is repeated 1 - 3 times with different random seeds. | ||
|
||
### API Documentation | ||
|
||
|
||
```eval_rst | ||
.. autofunction:: nni.nas.benchmark.nasbench201.query_nb201_computed_stats | ||
|
||
.. autoattribute:: nni.nas.benchmark.nasbench201.NONE | ||
|
||
.. autoattribute:: nni.nas.benchmark.nasbench201.SKIP_CONNECT | ||
|
||
.. autoattribute:: nni.nas.benchmark.nasbench201.CONV_1X1 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nasbench201.CONV_3X3 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nasbench201.AVG_POOL_3X3 | ||
|
||
.. autoclass:: nni.nas.benchmark.nasbench201.Nb201RunConfig | ||
|
||
.. autoclass:: nni.nas.benchmark.nasbench201.Nb201ComputedStats | ||
|
||
.. autoclass:: nni.nas.benchmark.nasbench201.Nb201IntermediateStats | ||
``` | ||
|
||
## NDS | ||
|
||
[Paper link](https://arxiv.org/abs/1905.13214) [Open-source](https://github.com/facebookresearch/nds) | ||
|
||
_On Network Design Spaces for Visual Recognition_ released computed statistics of over 100,000 configurations (models + hyper-parameters) sampled from multiple model families, including vanilla (feedforward network loosely inspired by VGG), ResNet and ResNeXt (residual basic block and residual bottleneck block) and NAS cells (following popular design from NASNet, Ameoba, PNAS, ENAS and DARTS). Most configurations are trained only once with a fixed seed, except a few that are trained twice or three times. | ||
|
||
Instead of storing results obtained with different configurations in separate files, we dump them into one single database to enable comparison in multiple dimensions. Specifically, we use `model_family` to distinguish model types, `model_spec` for all hyper-parameters needed to build this model, `cell_spec` for detailed information on operators and connections if it is a NAS cell, `generator` to denote the sampling policy through which this configuration is generated. Refer to API documentation for details. | ||
|
||
## Available Operators | ||
|
||
Here is a list of available operators used in NDS. | ||
|
||
```eval_rst | ||
.. autoattribute:: nni.nas.benchmark.nds.constants.NONE | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.SKIP_CONNECT | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.AVG_POOL_3X3 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.MAX_POOL_3X3 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.MAX_POOL_5X5 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.MAX_POOL_7X7 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.CONV_1X1 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.CONV_3X3 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.CONV_3X1_1X3 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.CONV_7X1_1X7 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.DIL_CONV_3X3 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.DIL_CONV_5X5 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.SEP_CONV_3X3 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.SEP_CONV_5X5 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.SEP_CONV_7X7 | ||
|
||
.. autoattribute:: nni.nas.benchmark.nds.constants.DIL_SEP_CONV_3X3 | ||
``` | ||
|
||
### API Documentation | ||
|
||
```eval_rst | ||
.. autofunction:: nni.nas.benchmark.nds.query_nds_computed_stats | ||
|
||
.. autoclass:: nni.nas.benchmark.nds.NdsRunConfig | ||
|
||
.. autoclass:: nni.nas.benchmark.nds.NdsComputedStats | ||
|
||
.. autoclass:: nni.nas.benchmark.nds.NdsIntermediateStats | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ json_tricks | |
numpy | ||
scipy | ||
coverage | ||
peewee | ||
schema | ||
tensorboard | ||
scikit-learn==0.20 | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark -> Benchmarks