Commit 02744b50 authored by Gems Guo's avatar Gems Guo Committed by goooxu
Browse files

Add README for building and uploading NNI package

parent 17d85669
# Setting variables # Setting variables
SHELL := /bin/bash SHELL := /bin/bash
PIP_INSTALL := python3 -m pip install PIP_INSTALL := pip3 install
PIP_UNINSTALL := python3 -m pip uninstall PIP_UNINSTALL := pip3 uninstall
## Colorful output ## Colorful output
_INFO := $(shell echo -e '\e[1;36m') _INFO := $(shell echo -e '\e[1;36m')
_WARNING := $(shell echo -e '\e[1;33m') _WARNING := $(shell echo -e '\e[1;33m')
_END := $(shell echo -e '\e[0m') _END := $(shell echo -e '\e[0m')
## Install directories ## Install directories
ifeq ($(shell id -u), 0) # is root ifeq ($(shell id -u), 0) # is root
_ROOT := 1 _ROOT := 1
BIN_FOLDER ?= /usr/local/bin BIN_FOLDER ?= /usr/local/bin
NNI_PKG_PATH ?= /usr/local/nni_pkg NNI_PKG_FOLDER ?= /usr/local/nni_pkg
BASH_COMP_SCRIPT ?= /usr/share/bash-completion/completions/nnictl BASH_COMP_SCRIPT ?= /usr/share/bash-completion/completions/nnictl
else # is normal user else # is normal user
BIN_FOLDER ?= ${HOME}/.local/bin BIN_FOLDER ?= ${HOME}/.local/bin
NNI_PKG_PATH ?= ${HOME}/.local/nni_pkg NNI_PKG_FOLDER ?= ${HOME}/.local/nni_pkg
ifndef VIRTUAL_ENV ifndef VIRTUAL_ENV
PIP_MODE ?= --user PIP_MODE ?= --user
endif endif
...@@ -104,7 +103,7 @@ dev-install: ...@@ -104,7 +103,7 @@ dev-install:
uninstall: uninstall:
-$(PIP_UNINSTALL) -y nni -$(PIP_UNINSTALL) -y nni
-$(PIP_UNINSTALL) -y nnictl -$(PIP_UNINSTALL) -y nnictl
-rm -rf $(NNI_PKG_PATH) -rm -rf $(NNI_PKG_FOLDER)
-rm -f $(BIN_FOLDER)/node -rm -f $(BIN_FOLDER)/node
-rm -f $(BIN_FOLDER)/nnictl -rm -f $(BIN_FOLDER)/nnictl
-rm -f $(BASH_COMP_SCRIPT) -rm -f $(BASH_COMP_SCRIPT)
...@@ -148,11 +147,11 @@ install-python-modules: ...@@ -148,11 +147,11 @@ install-python-modules:
.PHONY: install-node-modules .PHONY: install-node-modules
install-node-modules: install-node-modules:
#$(_INFO) Installing NNI Package $(_END) #$(_INFO) Installing NNI Package $(_END)
rm -rf $(NNI_PKG_PATH) rm -rf $(NNI_PKG_FOLDER)
cp -r src/nni_manager/dist $(NNI_PKG_PATH) cp -r src/nni_manager/dist $(NNI_PKG_FOLDER)
cp src/nni_manager/package.json $(NNI_PKG_PATH) cp src/nni_manager/package.json $(NNI_PKG_FOLDER)
$(NNI_YARN) --prod --cwd $(NNI_PKG_PATH) $(NNI_YARN) --prod --cwd $(NNI_PKG_FOLDER)
cp -r src/webui/build $(NNI_PKG_PATH)/static cp -r src/webui/build $(NNI_PKG_FOLDER)/static
.PHONY: install-dev-modules .PHONY: install-dev-modules
install-dev-modules: install-dev-modules:
...@@ -161,13 +160,12 @@ install-dev-modules: ...@@ -161,13 +160,12 @@ install-dev-modules:
#$(_INFO) Installing nnictl $(_END) #$(_INFO) Installing nnictl $(_END)
cd tools && $(PIP_INSTALL) $(PIP_MODE) -e . cd tools && $(PIP_INSTALL) $(PIP_MODE) -e .
rm -rf $(NNI_PKG_PATH)
#$(_INFO) Installing NNI Package $(_END) #$(_INFO) Installing NNI Package $(_END)
ln -sf ${PWD}/src/nni_manager/dist $(NNI_PKG_PATH) rm -rf $(NNI_PKG_FOLDER)
ln -sf ${PWD}/src/nni_manager/node_modules $(NNI_PKG_PATH)/node_modules ln -sf ${PWD}/src/nni_manager/dist $(NNI_PKG_FOLDER)
ln -sf ${PWD}/src/webui/build $(NNI_PKG_PATH)/static ln -sf ${PWD}/src/nni_manager/node_modules $(NNI_PKG_FOLDER)/node_modules
ln -sf ${PWD}/src/webui/build $(NNI_PKG_FOLDER)/static
.PHONY: install-scripts .PHONY: install-scripts
......
...@@ -24,13 +24,13 @@ The tool dispatches and runs trial jobs that generated by tuning algorithms to s ...@@ -24,13 +24,13 @@ The tool dispatches and runs trial jobs that generated by tuning algorithms to s
**Install through pip** **Install through pip**
* We only support Linux in current stage, Ubuntu 16.04 or higher are tested and supported. Simply run the following `pip install` in an environment that has `python >= 3.5`. * We only support Linux in current stage, Ubuntu 16.04 or higher are tested and supported. Simply run the following `pip install` in an environment that has `python >= 3.5`.
```bash ```bash
python3 -m pip install --user nni-pkg pip3 install --user nni-pkg
``` ```
**Install through source code** **Install through source code**
* We only support Linux in current stage, Ubuntu 16.04 or higher are tested and supported. Simply run the following `pip install` in an environment that has `python >= 3.5`, `git` and `wget`. * We only support Linux in current stage, Ubuntu 16.04 or higher are tested and supported. Simply run the following `pip install` in an environment that has `python >= 3.5`, `git` and `wget`.
```bash ```bash
git clone https://github.com/Microsoft/nni.git@v0.3 git clone -b v0.3 https://github.com/Microsoft/nni.git
cd nni cd nni
source install.sh source install.sh
``` ```
...@@ -40,7 +40,7 @@ The tool dispatches and runs trial jobs that generated by tuning algorithms to s ...@@ -40,7 +40,7 @@ The tool dispatches and runs trial jobs that generated by tuning algorithms to s
* And download the examples via clone the source code * And download the examples via clone the source code
```bash ```bash
cd ~ cd ~
git clone https://github.com/Microsoft/nni.git@v0.3 git clone -b v0.3 https://github.com/Microsoft/nni.git
``` ```
* Then, run the mnist example * Then, run the mnist example
```bash ```bash
......
...@@ -6,7 +6,7 @@ strategy: ...@@ -6,7 +6,7 @@ strategy:
PYTHON_VERSION: '3.6' PYTHON_VERSION: '3.6'
steps: steps:
- script: python3 -m pip install --upgrade pip setuptools - script: pip3 install --upgrade pip setuptools
displayName: 'Install python tools' displayName: 'Install python tools'
- script: | - script: |
source install.sh source install.sh
......
README.md
nni_pkg/ nni_pkg/
nni_annotation/ nni_annotation/
nnicmd/ nnicmd/
......
## Colorful output
_INFO := $(shell echo -e '\e[1;36m')
_WARNING := $(shell echo -e '\e[1;33m')
_END := $(shell echo -e '\e[0m')
CWD := $(PWD)/ CWD := $(PWD)/
.PHONY: build .PHONY: build
build: build:
python3 -m pip install --user --upgrade setuptools wheel pip3 install --user --upgrade setuptools wheel
wget https://aka.ms/nodejs-download -O $(CWD)node-linux-x64.tar.xz wget https://aka.ms/nodejs-download -O $(CWD)node-linux-x64.tar.xz
rm -rf $(CWD)node-linux-x64 rm -rf $(CWD)node-linux-x64
mkdir $(CWD)node-linux-x64 mkdir $(CWD)node-linux-x64
tar xf $(CWD)node-linux-x64.tar.xz -C node-linux-x64 --strip-components 1 tar xf $(CWD)node-linux-x64.tar.xz -C node-linux-x64 --strip-components 1
cp $(CWD)../../README.md $(CWD)
cd $(CWD)../../src/nni_manager && yarn && yarn build cd $(CWD)../../src/nni_manager && yarn && yarn build
cd $(CWD)../../src/webui && yarn && yarn build cd $(CWD)../../src/webui && yarn && yarn build
rm -rf $(CWD)nni_pkg rm -rf $(CWD)nni_pkg
...@@ -26,8 +21,9 @@ build: ...@@ -26,8 +21,9 @@ build:
cd $(CWD) && python3 setup.py bdist_wheel cd $(CWD) && python3 setup.py bdist_wheel
cd $(CWD)../../src/sdk/pynni && python3 setup.py bdist_wheel cd $(CWD)../../src/sdk/pynni && python3 setup.py bdist_wheel
cp -r $(CWD)../../src/sdk/pynni/dist/*.whl $(CWD)dist cp -r $(CWD)../../src/sdk/pynni/dist/*.whl $(CWD)dist
cd $(CWD)
.PHONY: upload .PHONY: upload
upload: upload:
python3 -m pip install --user --upgrade twine pip3 install --user --upgrade twine
python3 -m twine upload dist/* twine upload dist/*
\ No newline at end of file \ No newline at end of file
Python Package Index (PyPI) for NNI
===
## 1.Description
This is the PyPI build and upload tool for NNI project.
## 2.Prepare environment
Before build and upload NNI package, make sure the below OS and tools are available.
```
Ubuntu 16.04 LTS
make
wget
Python >= 3.5
Pip
Node.js
Yarn
```
## 2.How to build
```bash
make
```
## 3.How to upload
```bash
make upload
```
You may need to input the account and password of htts://pypi.org during this process.
\ No newline at end of file
...@@ -11,7 +11,7 @@ with open('../../README.md', 'r') as fh: ...@@ -11,7 +11,7 @@ with open('../../README.md', 'r') as fh:
setuptools.setup( setuptools.setup(
name = 'nni-pkg', name = 'nni-pkg',
version = '0.3', version = '0.3.0',
author = 'Microsoft NNI team', author = 'Microsoft NNI team',
author_email = 'nni@microsoft.com', author_email = 'nni@microsoft.com',
description = 'Neural Network Intelligence package', description = 'Neural Network Intelligence package',
......
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
git git
wget wget
python pip should also be correctly installed. You could use "python3 -m pip -V" to check in Linux. python pip should also be correctly installed. You could use "pip3 -v" to check in Linux.
* Note: we don't support virtual environment in current releases. * Note: we don't support virtual environment in current releases.
* __Install NNI through pip__ * __Install NNI through pip__
python3 -m pip install --user nni-pkg pip3 install --user nni-pkg
* __Install NNI through source code__ * __Install NNI through source code__
......
...@@ -14,14 +14,12 @@ ...@@ -14,14 +14,12 @@
* __Install NNI through pip__ * __Install NNI through pip__
pip3 install -v --user git+https://github.com/Microsoft/nni.git@v0.1 pip3 install --user nni-pkg
source ~/.bashrc
* __Install NNI through source code__ * __Install NNI through source code__
git clone -b v0.1 https://github.com/Microsoft/nni.git git clone -b v0.3 https://github.com/Microsoft/nni.git
cd nni cd nni
chmod +x install.sh
source install.sh source install.sh
......
...@@ -15,11 +15,11 @@ For remote machines that are used only to run trials but not the nnictl, you can ...@@ -15,11 +15,11 @@ For remote machines that are used only to run trials but not the nnictl, you can
* __Install python SDK through pip__ * __Install python SDK through pip__
python3 -m pip install --user nni pip3 install --user nni
* __Install python SDK through source code__ * __Install python SDK through source code__
git clone https://github.com/Microsoft/NeuralNetworkIntelligence git clone https://github.com/Microsoft/nni.git
cd src/sdk/pynni cd src/sdk/pynni
python3 setup.py install python3 setup.py install
......
...@@ -15,11 +15,11 @@ For remote machines that are used only to run trials but not the nnictl, you can ...@@ -15,11 +15,11 @@ For remote machines that are used only to run trials but not the nnictl, you can
* __Install python SDK through pip__ * __Install python SDK through pip__
python3 -m pip install --user nni pip3 install --user nni
* __Install python SDK through source code__ * __Install python SDK through source code__
git clone https://github.com/Microsoft/NeuralNetworkIntelligence git clone https://github.com/Microsoft/nni.git
cd src/sdk/pynni cd src/sdk/pynni
python3 setup.py install python3 setup.py install
......
...@@ -35,7 +35,7 @@ class CustomInstallCommand(install): ...@@ -35,7 +35,7 @@ class CustomInstallCommand(install):
setup( setup(
name = 'NNI', name = 'NNI',
version = '0.2.0', version = '0.3.0',
author = 'Microsoft NNI Team', author = 'Microsoft NNI Team',
author_email = 'nni@microsoft.com', author_email = 'nni@microsoft.com',
description = 'Neural Network Intelligence project', description = 'Neural Network Intelligence project',
......
...@@ -56,7 +56,7 @@ if python3 -c 'import nni' > /dev/null 2>&1; then ...@@ -56,7 +56,7 @@ if python3 -c 'import nni' > /dev/null 2>&1; then
return return
else else
# Install nni # Install nni
pip3 install -v --user nnipkg pip3 install -v --user nni-pkg
fi`; fi`;
export const PAI_TRIAL_COMMAND_FORMAT: string = export const PAI_TRIAL_COMMAND_FORMAT: string =
......
...@@ -27,7 +27,7 @@ def read(fname): ...@@ -27,7 +27,7 @@ def read(fname):
setuptools.setup( setuptools.setup(
name = 'nni', name = 'nni',
version = '0.2.1', version = '0.3.0',
packages = setuptools.find_packages(exclude=['tests']), packages = setuptools.find_packages(exclude=['tests']),
python_requires = '>=3.5', python_requires = '>=3.5',
......
...@@ -66,7 +66,6 @@ def start_rest_server(port, platform, mode, config_file_name, experiment_id=None ...@@ -66,7 +66,6 @@ def start_rest_server(port, platform, mode, config_file_name, experiment_id=None
exit(1) exit(1)
print_normal('Starting restful server...') print_normal('Starting restful server...')
manager = os.environ.get('NNI_MANAGER', 'nnimanager')
cmds = ['node', path.join(site.USER_BASE, 'nni_pkg', 'main.js'), '--port', str(port), '--mode', platform, '--start_mode', mode] cmds = ['node', path.join(site.USER_BASE, 'nni_pkg', 'main.js'), '--port', str(port), '--mode', platform, '--start_mode', mode]
if mode == 'resume': if mode == 'resume':
cmds += ['--experiment_id', experiment_id] cmds += ['--experiment_id', experiment_id]
......
...@@ -29,7 +29,7 @@ def process_install(package_name): ...@@ -29,7 +29,7 @@ def process_install(package_name):
print_error('{0} is not supported!' % package_name) print_error('{0} is not supported!' % package_name)
else: else:
requirements_path = os.path.join(nni.__path__[0], PACKAGE_REQUIREMENTS[package_name]) requirements_path = os.path.join(nni.__path__[0], PACKAGE_REQUIREMENTS[package_name])
cmds = 'cd ' + requirements_path + ' && python3 -m pip install --user -r requirements.txt' cmds = 'cd ' + requirements_path + ' && pip3 install --user -r requirements.txt'
call(cmds, shell=True) call(cmds, shell=True)
def package_install(args): def package_install(args):
......
...@@ -2,7 +2,7 @@ import setuptools ...@@ -2,7 +2,7 @@ import setuptools
setuptools.setup( setuptools.setup(
name = 'nnictl', name = 'nnictl',
version = '0.2.0', version = '0.3.0',
packages = setuptools.find_packages(exclude=['*test*']), packages = setuptools.find_packages(exclude=['*test*']),
python_requires = '>=3.5', python_requires = '>=3.5',
......
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