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
SHELL := /bin/bash
PIP_INSTALL := python3 -m pip install
PIP_UNINSTALL := python3 -m pip uninstall
PIP_INSTALL := pip3 install
PIP_UNINSTALL := pip3 uninstall
## Colorful output
_INFO := $(shell echo -e '\e[1;36m')
_WARNING := $(shell echo -e '\e[1;33m')
_END := $(shell echo -e '\e[0m')
## Install directories
ifeq ($(shell id -u), 0) # is root
_ROOT := 1
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
else # is normal user
BIN_FOLDER ?= ${HOME}/.local/bin
NNI_PKG_PATH ?= ${HOME}/.local/nni_pkg
NNI_PKG_FOLDER ?= ${HOME}/.local/nni_pkg
ifndef VIRTUAL_ENV
PIP_MODE ?= --user
endif
......@@ -104,7 +103,7 @@ dev-install:
uninstall:
-$(PIP_UNINSTALL) -y nni
-$(PIP_UNINSTALL) -y nnictl
-rm -rf $(NNI_PKG_PATH)
-rm -rf $(NNI_PKG_FOLDER)
-rm -f $(BIN_FOLDER)/node
-rm -f $(BIN_FOLDER)/nnictl
-rm -f $(BASH_COMP_SCRIPT)
......@@ -148,11 +147,11 @@ install-python-modules:
.PHONY: install-node-modules
install-node-modules:
#$(_INFO) Installing NNI Package $(_END)
rm -rf $(NNI_PKG_PATH)
cp -r src/nni_manager/dist $(NNI_PKG_PATH)
cp src/nni_manager/package.json $(NNI_PKG_PATH)
$(NNI_YARN) --prod --cwd $(NNI_PKG_PATH)
cp -r src/webui/build $(NNI_PKG_PATH)/static
rm -rf $(NNI_PKG_FOLDER)
cp -r src/nni_manager/dist $(NNI_PKG_FOLDER)
cp src/nni_manager/package.json $(NNI_PKG_FOLDER)
$(NNI_YARN) --prod --cwd $(NNI_PKG_FOLDER)
cp -r src/webui/build $(NNI_PKG_FOLDER)/static
.PHONY: install-dev-modules
install-dev-modules:
......@@ -161,13 +160,12 @@ install-dev-modules:
#$(_INFO) Installing nnictl $(_END)
cd tools && $(PIP_INSTALL) $(PIP_MODE) -e .
rm -rf $(NNI_PKG_PATH)
#$(_INFO) Installing NNI Package $(_END)
ln -sf ${PWD}/src/nni_manager/dist $(NNI_PKG_PATH)
ln -sf ${PWD}/src/nni_manager/node_modules $(NNI_PKG_PATH)/node_modules
ln -sf ${PWD}/src/webui/build $(NNI_PKG_PATH)/static
rm -rf $(NNI_PKG_FOLDER)
ln -sf ${PWD}/src/nni_manager/dist $(NNI_PKG_FOLDER)
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
......
......@@ -24,13 +24,13 @@ The tool dispatches and runs trial jobs that generated by tuning algorithms to s
**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`.
```bash
python3 -m pip install --user nni-pkg
pip3 install --user nni-pkg
```
**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`.
```bash
git clone https://github.com/Microsoft/nni.git@v0.3
git clone -b v0.3 https://github.com/Microsoft/nni.git
cd nni
source install.sh
```
......@@ -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
```bash
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
```bash
......
......@@ -6,7 +6,7 @@ strategy:
PYTHON_VERSION: '3.6'
steps:
- script: python3 -m pip install --upgrade pip setuptools
- script: pip3 install --upgrade pip setuptools
displayName: 'Install python tools'
- script: |
source install.sh
......
README.md
nni_pkg/
nni_annotation/
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)/
.PHONY: 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
rm -rf $(CWD)node-linux-x64
mkdir $(CWD)node-linux-x64
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/webui && yarn && yarn build
rm -rf $(CWD)nni_pkg
......@@ -26,8 +21,9 @@ build:
cd $(CWD) && 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
cd $(CWD)
.PHONY: upload
upload:
python3 -m pip install --user --upgrade twine
python3 -m twine upload dist/*
\ No newline at end of file
pip3 install --user --upgrade twine
twine upload dist/*
\ 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:
setuptools.setup(
name = 'nni-pkg',
version = '0.3',
version = '0.3.0',
author = 'Microsoft NNI team',
author_email = 'nni@microsoft.com',
description = 'Neural Network Intelligence package',
......
......@@ -8,13 +8,13 @@
git
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.
* __Install NNI through pip__
python3 -m pip install --user nni-pkg
pip3 install --user nni-pkg
* __Install NNI through source code__
......
......@@ -14,14 +14,12 @@
* __Install NNI through pip__
pip3 install -v --user git+https://github.com/Microsoft/nni.git@v0.1
source ~/.bashrc
pip3 install --user nni-pkg
* __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
chmod +x 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
* __Install python SDK through pip__
python3 -m pip install --user nni
pip3 install --user nni
* __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
python3 setup.py install
......
......@@ -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__
python3 -m pip install --user nni
pip3 install --user nni
* __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
python3 setup.py install
......
......@@ -35,7 +35,7 @@ class CustomInstallCommand(install):
setup(
name = 'NNI',
version = '0.2.0',
version = '0.3.0',
author = 'Microsoft NNI Team',
author_email = 'nni@microsoft.com',
description = 'Neural Network Intelligence project',
......
......@@ -56,7 +56,7 @@ if python3 -c 'import nni' > /dev/null 2>&1; then
return
else
# Install nni
pip3 install -v --user nnipkg
pip3 install -v --user nni-pkg
fi`;
export const PAI_TRIAL_COMMAND_FORMAT: string =
......
......@@ -27,7 +27,7 @@ def read(fname):
setuptools.setup(
name = 'nni',
version = '0.2.1',
version = '0.3.0',
packages = setuptools.find_packages(exclude=['tests']),
python_requires = '>=3.5',
......
......@@ -66,7 +66,6 @@ def start_rest_server(port, platform, mode, config_file_name, experiment_id=None
exit(1)
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]
if mode == 'resume':
cmds += ['--experiment_id', experiment_id]
......
......@@ -29,7 +29,7 @@ def process_install(package_name):
print_error('{0} is not supported!' % package_name)
else:
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)
def package_install(args):
......
......@@ -2,7 +2,7 @@ import setuptools
setuptools.setup(
name = 'nnictl',
version = '0.2.0',
version = '0.3.0',
packages = setuptools.find_packages(exclude=['*test*']),
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