Unverified Commit 4dfd9d14 authored by liuzhe-lz's avatar liuzhe-lz Committed by GitHub
Browse files

Merge pull request #2254 from microsoft/v1.5

Merge v1.5 branch back to master
parents d2c57770 7d586d3f
...@@ -17,8 +17,9 @@ interface AppState { ...@@ -17,8 +17,9 @@ interface AppState {
} }
class App extends React.Component<{}, AppState> { class App extends React.Component<{}, AppState> {
private timerId!: number | null; private timerId!: number | undefined;
private dataFormatimer!: number; private dataFormatimer!: number;
private firstLoad: boolean = false; // when click refresh selector options
constructor(props: {}) { constructor(props: {}) {
super(props); super(props);
...@@ -66,14 +67,20 @@ class App extends React.Component<{}, AppState> { ...@@ -66,14 +67,20 @@ class App extends React.Component<{}, AppState> {
} }
} }
} }
changeInterval = (interval: number): void => { changeInterval = (interval: number): void => {
this.setState({ interval });
if (this.timerId === null && interval !== 0) { window.clearTimeout(this.timerId);
window.setTimeout(this.refresh); if (interval === 0) {
} else if (this.timerId !== null && interval === 0) { return;
window.clearTimeout(this.timerId);
} }
// setState will trigger page refresh at once.
// setState is asyc, interval not update to (this.state.interval) at once.
this.setState({interval}, () => {
this.firstLoad = true;
this.refresh();
});
} }
// TODO: use local storage // TODO: use local storage
...@@ -123,24 +130,30 @@ class App extends React.Component<{}, AppState> { ...@@ -123,24 +130,30 @@ class App extends React.Component<{}, AppState> {
} }
private refresh = async (): Promise<void> => { private refresh = async (): Promise<void> => {
const [experimentUpdated, trialsUpdated] = await Promise.all([EXPERIMENT.update(), TRIALS.update()]);
if (experimentUpdated) { // resolve this question: 10s -> 20s, page refresh twice.
this.setState(state => ({ experimentUpdateBroadcast: state.experimentUpdateBroadcast + 1 })); // only refresh this page after clicking the refresh options
} if (this.firstLoad !== true) {
if (trialsUpdated) { const [experimentUpdated, trialsUpdated] = await Promise.all([EXPERIMENT.update(), TRIALS.update()]);
this.setState(state => ({ trialsUpdateBroadcast: state.trialsUpdateBroadcast + 1 })); if (experimentUpdated) {
this.setState(state => ({ experimentUpdateBroadcast: state.experimentUpdateBroadcast + 1 }));
}
if (trialsUpdated) {
this.setState(state => ({ trialsUpdateBroadcast: state.trialsUpdateBroadcast + 1 }));
}
} else {
this.firstLoad = false;
} }
if (['DONE', 'ERROR', 'STOPPED'].includes(EXPERIMENT.status)) { if (['DONE', 'ERROR', 'STOPPED'].includes(EXPERIMENT.status)) {
// experiment finished, refresh once more to ensure consistency // experiment finished, refresh once more to ensure consistency
if (this.state.interval > 0) { this.setState({ interval: 0 });
this.setState({ interval: 0 }); this.lastRefresh();
this.lastRefresh(); return;
}
} else if (this.state.interval !== 0) {
this.timerId = window.setTimeout(this.refresh, this.state.interval * 1000);
} }
this.timerId = window.setTimeout(this.refresh, this.state.interval * 1000);
} }
public async lastRefresh(): Promise<void> { public async lastRefresh(): Promise<void> {
......
This diff is collapsed.
import time
import nni
if __name__ == '__main__':
print('trial start')
params = nni.get_next_parameter()
print('params:', params)
epochs = 2
for i in range(epochs):
nni.report_intermediate_result(0.1 * (i+1))
time.sleep(1)
nni.report_final_result(0.8)
print('trial done')
...@@ -70,12 +70,18 @@ testCases: ...@@ -70,12 +70,18 @@ testCases:
config: config:
maxTrialNum: 2 maxTrialNum: 2
trialConcurrency: 2 trialConcurrency: 2
trial:
codeDir: ../naive_trial
command: python3 naive_trial.py
- name: assessor-medianstop - name: assessor-medianstop
configFile: test/config/assessors/medianstop.yml configFile: test/config/assessors/medianstop.yml
config: config:
maxTrialNum: 2 maxTrialNum: 2
trialConcurrency: 2 trialConcurrency: 2
trial:
codeDir: ../naive_trial
command: python3 naive_trial.py
######################################################################### #########################################################################
# nni tuners test # nni tuners test
...@@ -89,7 +95,7 @@ testCases: ...@@ -89,7 +95,7 @@ testCases:
searchSpacePath: ../naive_trial/search_space.json searchSpacePath: ../naive_trial/search_space.json
trial: trial:
codeDir: ../naive_trial codeDir: ../naive_trial
command: python3 trial.py command: python3 naive_trial.py
- name: tuner-evolution - name: tuner-evolution
configFile: test/config/tuners/evolution.yml configFile: test/config/tuners/evolution.yml
...@@ -100,7 +106,7 @@ testCases: ...@@ -100,7 +106,7 @@ testCases:
searchSpacePath: ../naive_trial/search_space.json searchSpacePath: ../naive_trial/search_space.json
trial: trial:
codeDir: ../naive_trial codeDir: ../naive_trial
command: python3 trial.py command: python3 naive_trial.py
- name: tuner-random - name: tuner-random
configFile: test/config/tuners/random.yml configFile: test/config/tuners/random.yml
...@@ -111,7 +117,7 @@ testCases: ...@@ -111,7 +117,7 @@ testCases:
searchSpacePath: ../naive_trial/search_space.json searchSpacePath: ../naive_trial/search_space.json
trial: trial:
codeDir: ../naive_trial codeDir: ../naive_trial
command: python3 trial.py command: python3 naive_trial.py
- name: tuner-tpe - name: tuner-tpe
configFile: test/config/tuners/tpe.yml configFile: test/config/tuners/tpe.yml
...@@ -122,7 +128,7 @@ testCases: ...@@ -122,7 +128,7 @@ testCases:
searchSpacePath: ../naive_trial/search_space.json searchSpacePath: ../naive_trial/search_space.json
trial: trial:
codeDir: ../naive_trial codeDir: ../naive_trial
command: python3 trial.py command: python3 naive_trial.py
- name: tuner-batch - name: tuner-batch
configFile: test/config/tuners/batch.yml configFile: test/config/tuners/batch.yml
...@@ -144,7 +150,7 @@ testCases: ...@@ -144,7 +150,7 @@ testCases:
searchSpacePath: ../naive_trial/search_space.json searchSpacePath: ../naive_trial/search_space.json
trial: trial:
codeDir: ../naive_trial codeDir: ../naive_trial
command: python3 trial.py command: python3 naive_trial.py
- name: tuner-grid - name: tuner-grid
configFile: test/config/tuners/gridsearch.yml configFile: test/config/tuners/gridsearch.yml
......
...@@ -10,7 +10,7 @@ jobs: ...@@ -10,7 +10,7 @@ jobs:
python -m pip install scikit-learn==0.20.0 --user python -m pip install scikit-learn==0.20.0 --user
python -m pip install keras==2.1.6 --user python -m pip install keras==2.1.6 --user
python -m pip install torchvision===0.4.1 torch===1.3.1 -f https://download.pytorch.org/whl/torch_stable.html --user python -m pip install torchvision===0.4.1 torch===1.3.1 -f https://download.pytorch.org/whl/torch_stable.html --user
python -m pip install tensorflow-gpu==1.11.0 --user python -m pip install tensorflow-gpu==1.15.2 --user
displayName: 'Install dependencies for integration tests' displayName: 'Install dependencies for integration tests'
- script: | - script: |
cd test cd test
......
...@@ -63,6 +63,7 @@ jobs: ...@@ -63,6 +63,7 @@ jobs:
cd test cd test
set PATH=$(ENV_PATH) set PATH=$(ENV_PATH)
python --version python --version
python nni_test/nnitest/generate_ts_config.py --ts pai --pai_host $(pai_host) --pai_user $(pai_user) --pai_pwd $(pai_pwd) --vc $(pai_virtual_cluster) --nni_docker_image $(docker_image) --data_dir $(data_dir) --output_dir $(output_dir) --nni_manager_ip $(nni_manager_ip) mount -o anon $(pai_nfs_uri) $(local_nfs_uri)
python nni_test/nnitest/generate_ts_config.py --ts pai --pai_token $(pai_token) --pai_host $(pai_host) --pai_user $(pai_user) --nni_docker_image $(docker_image) --pai_storage_plugin $(pai_storage_plugin) --nni_manager_nfs_mount_path $(nni_manager_nfs_mount_path) --container_nfs_mount_path $(container_nfs_mount_path) --nni_manager_ip $(nni_manager_ip)
python nni_test/nnitest/run_tests.py --config config/integration_tests.yml --ts pai --exclude multi-phase python nni_test/nnitest/run_tests.py --config config/integration_tests.yml --ts pai --exclude multi-phase
displayName: 'Examples and advanced features tests on pai' displayName: 'Examples and advanced features tests on pai'
\ No newline at end of file
...@@ -52,9 +52,3 @@ jobs: ...@@ -52,9 +52,3 @@ jobs:
runOptions: commands runOptions: commands
commands: python3 /tmp/nnitest/$(Build.BuildId)/nni-remote/test/nni_test/nnitest/remote_docker.py --mode stop --name $(Build.BuildId) --os windows commands: python3 /tmp/nnitest/$(Build.BuildId)/nni-remote/test/nni_test/nnitest/remote_docker.py --mode stop --name $(Build.BuildId) --os windows
displayName: 'Stop docker' displayName: 'Stop docker'
- task: SSH@0
inputs:
sshEndpoint: $(end_point)
runOptions: commands
commands: sudo rm -rf /tmp/nnitest/$(Build.BuildId)
displayName: 'Clean the remote files'
...@@ -19,6 +19,15 @@ do ...@@ -19,6 +19,15 @@ do
python3 model_prune_torch.py --pruner_name $name --pretrain_epochs 1 --prune_epochs 1 python3 model_prune_torch.py --pruner_name $name --pretrain_epochs 1 --prune_epochs 1
done done
echo 'testing level pruner pruning'
python3 model_prune_torch.py --pruner_name level --pretrain_epochs 1 --prune_epochs 1
echo 'testing agp pruning'
python3 model_prune_torch.py --pruner_name agp --pretrain_epochs 1 --prune_epochs 2
echo 'testing mean_activation pruning'
python3 model_prune_torch.py --pruner_name mean_activation --pretrain_epochs 1 --prune_epochs 1
#echo "testing lottery ticket pruning..." #echo "testing lottery ticket pruning..."
#python3 lottery_torch_mnist_fc.py #python3 lottery_torch_mnist_fc.py
......
...@@ -28,9 +28,10 @@ cd $EXAMPLE_DIR/enas ...@@ -28,9 +28,10 @@ cd $EXAMPLE_DIR/enas
python3 search.py --search-for macro --epochs 1 python3 search.py --search-for macro --epochs 1
python3 search.py --search-for micro --epochs 1 python3 search.py --search-for micro --epochs 1
echo "testing naive..." #disabled for now
cd $EXAMPLE_DIR/naive #echo "testing naive..."
python3 train.py #cd $EXAMPLE_DIR/naive
#python3 train.py
echo "testing pdarts..." echo "testing pdarts..."
cd $EXAMPLE_DIR/pdarts cd $EXAMPLE_DIR/pdarts
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment