diff --git a/.travis.yml b/.travis.yml index cdd3a98153..bc0c3333b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,15 +4,15 @@ language: python python: - "3.6" before_install: - - sudo apt-get install -y python3-pip python3-setuptools - wget https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz - tar xf node-v10.9.0-linux-x64.tar.xz - sudo mv node-v10.9.0-linux-x64 /usr/local/node - export PATH=/usr/local/node/bin:$PATH install: - make - - sudo make dev-install + - make install + - export PATH=$HOME/.nni/bin:$PATH before_script: - cd test/naive script: - - python run.py \ No newline at end of file + - python3 run.py \ No newline at end of file diff --git a/Makefile b/Makefile index 92cda32d3a..acb6927bdd 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ -BIN_PATH ?= /usr/bin -NODE_PATH ?= /usr/share -EXAMPLE_PATH ?= /usr/share/nni/examples +BIN_PATH ?= $(HOME)/.nni/bin/ +NNI_PATH ?= $(HOME)/.nni/ SRC_DIR := ${PWD} @@ -21,33 +20,33 @@ build: install: - mkdir -p $(NODE_PATH)/nni - mkdir -p $(EXAMPLE_PATH) + mkdir -p $(NNI_PATH) + mkdir -p $(BIN_PATH) ### Installing NNI Manager ### - cp -rT src/nni_manager/dist $(NODE_PATH)/nni/nni_manager - cp -rT src/nni_manager/node_modules $(NODE_PATH)/nni/nni_manager/node_modules + cp -rT src/nni_manager/dist $(NNI_PATH)nni_manager + cp -rT src/nni_manager/node_modules $(NNI_PATH)nni_manager/node_modules ### Installing Web UI ### - cp -rT src/webui/build $(NODE_PATH)/nni/webui - ln -sf $(NODE_PATH)/nni/nni_manager/node_modules/serve/bin/serve.js $(BIN_PATH)/serve + cp -rT src/webui/build $(NNI_PATH)webui + ln -sf $(NNI_PATH)nni_manager/node_modules/serve/bin/serve.js $(BIN_PATH)serve ### Installing Python SDK dependencies ### pip3 install -r src/sdk/pynni/requirements.txt ### Installing Python SDK ### - cd src/sdk/pynni && python3 setup.py install + cd src/sdk/pynni && pip3 install -e . ### Installing nnictl ### - cd tools && python3 setup.py install + cd tools && pip3 install -e . - echo '#!/bin/sh' > $(BIN_PATH)/nnimanager - echo 'cd $(NODE_PATH)/nni/nni_manager && node main.js $$@' >> $(BIN_PATH)/nnimanager - chmod +x $(BIN_PATH)/nnimanager + echo '#!/bin/sh' > $(BIN_PATH)nnimanager + echo 'cd $(NNI_PATH)nni_manager && node main.js $$@' >> $(BIN_PATH)nnimanager + chmod +x $(BIN_PATH)nnimanager - install -m 755 tools/nnictl $(BIN_PATH)/nnictl + install -m 755 tools/nnictl $(BIN_PATH)nnictl ### Installing examples ### - cp -rT examples $(EXAMPLE_PATH) + cp -rT examples $(NNI_PATH)examples dev-install: @@ -61,10 +60,8 @@ dev-install: uninstall: - -rm -r $(EXAMPLE_PATH) - -rm -r $(NODE_PATH)/nni + -rm -r $(NNI_PATH) + -rm -r $(BIN_PATH) -pip3 uninstall -y nnictl -pip3 uninstall -y nni - -rm $(BIN_PATH)/nnictl - -rm $(BIN_PATH)/nnimanager - -rm $(BIN_PATH)/serve + diff --git a/docs/EnableAssessor.md b/docs/EnableAssessor.md index 27da00839f..ad29dc879b 100644 --- a/docs/EnableAssessor.md +++ b/docs/EnableAssessor.md @@ -25,7 +25,7 @@ assessor: optimizationMode: Maximize trial: trialCommand: python mnist.py - trialCodeDir: /usr/share/nni/examples/trials/mnist-annotation + trialCodeDir: $HOME/.nni/examples/trials/mnist-annotation trialGpuNum: 0 ``` For our built-in assessors, you need to fill two fields: `assessorName` which chooses NNI provided assessors (refer to [here]() for built-in assessors), `optimizationMode` which includes Maximize and Minimize (you want to maximize or minimize your trial result). @@ -54,7 +54,7 @@ assessor: assessorGpuNum: 0 trial: trialCommand: python mnist.py - trialCodeDir: /usr/share/nni/examples/trials/mnist-annotation + trialCodeDir: $HOME/.nni/examples/trials/mnist-annotation trialGpuNum: 0 ``` You only need to fill three field: `assessorCommand`, `assessorCodeDir` and `assessorGpuNum`. \ No newline at end of file diff --git a/docs/GetStarted.md b/docs/GetStarted.md index 7606e53643..5c38a4bb2d 100644 --- a/docs/GetStarted.md +++ b/docs/GetStarted.md @@ -57,7 +57,7 @@ Requirements: Run the following command to create an experiemnt for [mnist] ```bash - nnictl create --config /usr/share/nni/examples/trials/mnist-annotation/config.yaml + nnictl create --config $HOME/.nni/examples/trials/mnist-annotation/config.yaml ``` This command will start the experiment and WebUI. The WebUI endpoint will be shown in the output of this command (for example, `http://localhost:8080`). Open this URL using your browsers. You can analyze your experiment through WebUI, or open trials' tensorboard. @@ -69,9 +69,9 @@ An experiment is to run multiple trial jobs, each trial job tries a configuratio * Provide a yaml experiment configure file * (optional) Provide or choose an assessor -**Prepare trial**: Let's use a simple trial example, e.g. mnist, provided by NNI. After you installed NNI, NNI examples have been put in /usr/share/nni/examples, run `ls /usr/share/nni/examples/trials` to see all the trial examples. You can simply execute the following command to run the NNI mnist example: +**Prepare trial**: Let's use a simple trial example, e.g. mnist, provided by NNI. After you installed NNI, NNI examples have been put in $HOME/.nni/examples, run `ls $HOME/.nni/examples/trials` to see all the trial examples. You can simply execute the following command to run the NNI mnist example: - python /usr/share/nni/examples/trials/mnist-annotation/mnist.py + python $HOME/.nni/examples/trials/mnist-annotation/mnist.py This command will be filled in the yaml configure file below. Please refer to [here]() for how to write your own trial. @@ -82,7 +82,7 @@ This command will be filled in the yaml configure file below. Please refer to [h *tunerName* is used to specify a tuner in NNI, *optimizationMode* is to indicate whether you want to maximize or minimize your trial's result. -**Prepare configure file**: Since you have already known which trial code you are going to run and which tuner you are going to use, it is time to prepare the yaml configure file. NNI provides a demo configure file for each trial example, `cat /usr/share/nni/examples/trials/mnist-annotation/config.yaml` to see it. Its content is basically shown below: +**Prepare configure file**: Since you have already known which trial code you are going to run and which tuner you are going to use, it is time to prepare the yaml configure file. NNI provides a demo configure file for each trial example, `cat $HOME/.nni/examples/trials/mnist-annotation/config.yaml` to see it. Its content is basically shown below: ``` authorName: your_name @@ -102,7 +102,7 @@ tuner: optimizationMode: Maximize trial: trialCommand: python mnist.py - trialCodeDir: /usr/share/nni/examples/trials/mnist-annotation + trialCodeDir: $HOME/.nni/examples/trials/mnist-annotation trialGpuNum: 0 ``` @@ -110,7 +110,7 @@ Here *useAnnotation* is true because this trial example uses our python annotati With all these steps done, we can run the experiment with the following command: - nnictl create --config /usr/share/nni/examples/trials/mnist-annotation/config.yaml + nnictl create --config $HOME/.nni/examples/trials/mnist-annotation/config.yaml You can refer to [here](NNICTLDOC.md) for more usage guide of *nnictl* command line tool. diff --git a/docs/RemoteMachineMode.md b/docs/RemoteMachineMode.md index aac50f0e42..8a566e6970 100644 --- a/docs/RemoteMachineMode.md +++ b/docs/RemoteMachineMode.md @@ -30,7 +30,7 @@ tuner: optimizationMode: Maximize trial: trialCommand: python mnist.py - trialCodeDir: /usr/share/nni/examples/trials/mnist-annotation + trialCodeDir: $HOME/.nni/examples/trials/mnist-annotation trialGpuNum: 0 #machineList can be empty if the platform is local machineList: diff --git a/examples/trials/cifar10/config.yml b/examples/trials/cifar10/config.yml index d4172cfca8..ab90524cf4 100644 --- a/examples/trials/cifar10/config.yml +++ b/examples/trials/cifar10/config.yml @@ -5,7 +5,7 @@ maxExecDuration: 1h maxTrialNum: 1 #choice: local, remote trainingServicePlatform: local -searchSpacePath: /usr/share/nni/examples/trials/cifar10/search_space.json +searchSpacePath: $HOME/.nni/examples/trials/cifar10/search_space.json #choice: true, false useAnnotation: false tuner: @@ -15,5 +15,5 @@ tuner: optimizationMode: Maximize trial: trialCommand: python3 cifar10.py - trialCodeDir: /usr/share/nni/examples/trials/cifar10 + trialCodeDir: $HOME/.nni/examples/trials/cifar10 trialGpuNum: 0 \ No newline at end of file diff --git a/examples/trials/ga_squad/config.yml b/examples/trials/ga_squad/config.yml index 4ab3b001b9..6435ee53b5 100644 --- a/examples/trials/ga_squad/config.yml +++ b/examples/trials/ga_squad/config.yml @@ -9,8 +9,8 @@ trainingServicePlatform: local useAnnotation: false tuner: tunerCommand: python3 __main__.py - tunerCwd: /usr/share/nni/examples/tuners/ga_customer_tuner + tunerCwd: $HOME/.nni/examples/tuners/ga_customer_tuner trial: trialCommand: python3 trial.py - trialCodeDir: /usr/share/nni/examples/trials/ga_squad + trialCodeDir: $HOME/.nni/examples/trials/ga_squad trialGpuNum: 0 \ No newline at end of file diff --git a/examples/trials/mnist-annotation/config.yml b/examples/trials/mnist-annotation/config.yml index a651219302..34a9e82f9d 100644 --- a/examples/trials/mnist-annotation/config.yml +++ b/examples/trials/mnist-annotation/config.yml @@ -14,5 +14,5 @@ tuner: optimizationMode: Maximize trial: trialCommand: python3 mnist.py - trialCodeDir: /usr/share/nni/examples/trials/mnist-annotation + trialCodeDir: $HOME/.nni/examples/trials/mnist-annotation trialGpuNum: 0 \ No newline at end of file diff --git a/examples/trials/mnist-keras/config.yml b/examples/trials/mnist-keras/config.yml index f115073259..7752021a67 100644 --- a/examples/trials/mnist-keras/config.yml +++ b/examples/trials/mnist-keras/config.yml @@ -5,7 +5,7 @@ maxExecDuration: 1h maxTrialNum: 1 #choice: local, remote trainingServicePlatform: local -searchSpacePath: /usr/share/nni/examples/trials/mnist-keras/search_space.json +searchSpacePath: $HOME/.nni/examples/trials/mnist-keras/search_space.json #choice: true, false useAnnotation: false tuner: @@ -15,5 +15,5 @@ tuner: optimizationMode: Maximize trial: trialCommand: python3 mnist-keras.py - trialCodeDir: /usr/share/nni/examples/trials/mnist-keras + trialCodeDir: $HOME/.nni/examples/trials/mnist-keras trialGpuNum: 0 \ No newline at end of file diff --git a/examples/trials/mnist-smartparam/config.yml b/examples/trials/mnist-smartparam/config.yml index 1af926cb37..60eb957374 100644 --- a/examples/trials/mnist-smartparam/config.yml +++ b/examples/trials/mnist-smartparam/config.yml @@ -14,5 +14,5 @@ tuner: optimizationMode: Maximize trial: trialCommand: python3 mnist.py - trialCodeDir: /usr/share/nni/examples/trials/mnist-smartparam + trialCodeDir: $HOME/.nni/examples/trials/mnist-smartparam trialGpuNum: 0 \ No newline at end of file diff --git a/examples/trials/mnist/config.yml b/examples/trials/mnist/config.yml index cf2d4cc8eb..206db7097c 100644 --- a/examples/trials/mnist/config.yml +++ b/examples/trials/mnist/config.yml @@ -5,7 +5,7 @@ maxExecDuration: 1h maxTrialNum: 1 #choice: local, remote trainingServicePlatform: local -searchSpacePath: /usr/share/nni/examples/trials/mnist/search_space.json +searchSpacePath: $HOME/.nni/examples/trials/mnist/search_space.json #choice: true, false useAnnotation: false tuner: @@ -15,5 +15,5 @@ tuner: optimizationMode: Maximize trial: trialCommand: python3 mnist.py - trialCodeDir: /usr/share/nni/examples/trials/mnist + trialCodeDir: $HOME/.nni/examples/trials/mnist trialGpuNum: 0 \ No newline at end of file diff --git a/tools/nnicmd/webui_utils.py b/tools/nnicmd/webui_utils.py index 010609965e..6a0fc73d70 100644 --- a/tools/nnicmd/webui_utils.py +++ b/tools/nnicmd/webui_utils.py @@ -29,7 +29,7 @@ def start_web_ui(port): '''start web ui''' - cmds = ['serve', '-s', '-n', '/usr/share/nni/webui', '-l', str(port)] + cmds = ['serve', '-s', '-n', '$HOME/.nni/webui', '-l', str(port)] stdout_file = open(STDOUT_FULL_PATH, 'a+') stderr_file = open(STDERR_FULL_PATH, 'a+') webui_process = Popen(cmds, stdout=stdout_file, stderr=stderr_file) diff --git a/tools/setup.py b/tools/setup.py index ab0b5825fc..5853482ae0 100644 --- a/tools/setup.py +++ b/tools/setup.py @@ -9,7 +9,8 @@ install_requires = [ 'requests', 'pyyaml', - 'psutil' + 'psutil', + 'astor' ], author = 'Microsoft NNI Team',