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
Implement enas-mode and oneshot-mode for NAS interface #1201
Merged
Conversation
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
xuehui1991
reviewed
Jun 25, 2019
QuanluZhang
reviewed
Jun 25, 2019
please pass pylint |
QuanluZhang
reviewed
Jun 25, 2019
QuanluZhang
reviewed
Jun 25, 2019
QuanluZhang
reviewed
Jun 25, 2019
QuanluZhang
reviewed
Jun 25, 2019
QuanluZhang
reviewed
Jun 25, 2019
QuanluZhang
reviewed
Jun 25, 2019
QuanluZhang
approved these changes
Jun 25, 2019
leckie-chn
approved these changes
Jun 25, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Related issue #1159, used to run ENAS
API Changes
In the new version of NAS interface, users need to specify the NAS mode in their Config.yml for NNI under the
trial
section. Like this:Currently there are three modes available:
classic_mode
: The same as the original version of NAS interfaceenas_mode
: An efficient mode developed for tensorflow to run ENAS (introduced in the following)oneshot_mode
: A mode for users to train a full graph of a search space, where all the inputs and operations will be chosen and summed togetherDifferent modes
enas_mode
Overview
In tensorflow, users need to build graph first and then create a session to run that graph. In the previous version, the graph of a trial will be determined (to be a sub-graph) once it receives a parameter configuration from the tuner. That is to say, the graph of this trial will not change even if it receives other parameter configurations in the future.
So in this mode we will create and use tensorflow variable as signals, and tensorflow conditional functions to control the search space (full-graph) to be more flexible, which means it can be changed into different sub-graphs (multiple times) depending on these signals.
API Changes
Users need to add
nni.get_next_parameter(session)
before they invoke the session.run function:Note that they need to pass their tensorflow session as an arg into this function. An example might be:
oneshot-mode
We provide a mode for users to train oneshot model.
In this mode, every inputs and operations will be chosen. As suggested in the paper, a dropout method is implemented to the inputs for every layer. The dropout rate is set to r^(1/k), where 0 < r < 1 is a hyper-parameter of the model (default to 0.01) and k is number of optional inputs for a specific layer. The higher the fan-in, the more likely each possible input is to be dropped out. However, the probability of dropping out all optional_inputs of a layer is kept constant regardless of its fan-in. Suppose r = 0.05. If a layer has k = 2 optional_inputs then each one will independently be dropped out with probability 0.051/2 ≈ 0.22 and will be retained with probability 0.78. If a layer has k = 7 optional_inputs then each one will independently be dropped out with probability 0.051/7 ≈ 0.65 and will be retained with probability 0.35. In both cases, the probability of dropping out all of the layer's optional_inputs is 5%.