README.md 3.46 KB
Newer Older
xuanbaby's avatar
DTK-x  
xuanbaby committed
1
2
3
4
<p align="center">
<img src="docs/img/nni_logo.png" width="300"/>
</p>

zhanggzh's avatar
zhanggzh committed
5
**NNI (Neural Network Intelligence)** 是一个帮助用户 **自动** 进行特征工程,神经网络架构搜索,超参调优以及模型压缩的轻量且强大的工具包。
xuanbaby's avatar
DTK-x  
xuanbaby committed
6

zhanggzh's avatar
zhanggzh committed
7
NNI 管理自动机器学习 (AutoML) 的 Experiment,**调度运行** 由调优算法生成的 Trial 任务来找到最好的神经网络架构和/或超参,支持**各种训练环境**,如本机,远程服务器,OpenPAI,Kubeflow,基于 K8S 的 FrameworkController(如,AKS 等), DLWorkspace (又称 DLTS), AML (Azure Machine Learning), AdaptDL(又称 ADL) ,和其他的云平台甚至 混合模式 。 DLTS),AML (Azure Machine Learning)AdaptDL(又称 ADL) ,和其他的云平台甚至混合模式。""
xuanbaby's avatar
DTK-x  
xuanbaby committed
8

zhanggzh's avatar
zhanggzh committed
9
10
11
12
13
## **使用场景**
* 想要在自己的代码、模型中试验不同的自动机器学习算法。
* 想要在不同的环境中加速运行自动机器学习。
* 想要更容易实现或试验新的自动机器学习算法的研究员或数据科学家,包括:超参调优算法,神经网络搜索算法以及模型压缩算法。
* 在机器学习平台中支持自动机器学习。
xuanbaby's avatar
DTK-x  
xuanbaby committed
14

zhanggzh's avatar
zhanggzh committed
15
## **安装**
xuanbaby's avatar
DTK-x  
xuanbaby committed
16

zhanggzh's avatar
zhanggzh committed
17
### **安装方式**
xuanbaby's avatar
DTK-x  
xuanbaby committed
18

zhanggzh's avatar
zhanggzh committed
19
#### **使用源码编译方式安装**
xuanbaby's avatar
DTK-x  
xuanbaby committed
20

zhanggezhong's avatar
zhanggezhong committed
21
编译之前,需要先安装对应版本python,安装相应的三方包依赖项,并配置DTK环境变量(ubuntu24.04为例)。
xuanbaby's avatar
DTK-x  
xuanbaby committed
22
23

```bash
zhanggzh's avatar
zhanggzh committed
24
# 安装三方包的源
zhanggezhong's avatar
zhanggezhong committed
25
sudo apt-get install install  epel-release  -y
zhanggzh's avatar
zhanggzh committed
26
27

# 安装相关依赖项
zhanggezhong's avatar
zhanggezhong committed
28
29
30
sudo apt-get install install libffi-devel -y
sudo apt-get installinstall openssl-devel openssl -y
sudo apt-get install -y install sqlite-devel
zhanggzh's avatar
zhanggzh committed
31
32
33
34
35
36
37
38
39
40
41
42
43
# 若python内未包含相关项,需基于上面安装的三方包重新源码编译python,再配置python环境
pip3 install protobuf==3.20
pip3 install wheel
pip3 install jupyter
pip3 install jupyterlab==3.0.9
pip3 install colorama
pip3 install cloudpickle
pip3 install json_tricks
pip3 install 'typeguard<3'
pip3 install astor
pip3 install schema
python3 -m pip install --upgrade pip setuptools

zhanggezhong's avatar
zhanggezhong committed
44
45
46
47
# 下载DTK
cd opt
wget https://cancon.hpccube.com:65024/directlink/1/DTK-24.04/Ubuntu20.04.1/DTK-24.04-Ubuntu20.04.1-x86_64.tar.gz
tar -xvf *tar.gz 解压DTK
zhanggzh's avatar
zhanggzh committed
48
49
export ROCM_PATH=/opt/dtk-24.04
source /opt/dtk-24.04/env.sh
xuanbaby's avatar
DTK-x  
xuanbaby committed
50
51
```

zhanggzh's avatar
zhanggzh committed
52
编译nni
xuanbaby's avatar
DTK-x  
xuanbaby committed
53
54

```bash
zhanggzh's avatar
zhanggzh committed
55
56
57
58
# 下载源码 
git clone -b dtk23.10-v2.10 http://developer.hpccube.com/codes/aicomponent/nni.git
cd nni
export NNI_RELEASE=2.10
zhanggezhong's avatar
zhanggezhong committed
59
60
61
export PATH=$PATH:/usr/local/python3.10.12/bin
export PATH=$PATH:/usr/local/python3.10.12/bin/jupyter
export LD_LIBRARY_PATH=/usr/local/python3.10.12/lib:$LD_LIBRARY_PATH
zhanggzh's avatar
zhanggzh committed
62
63
64
python3 setup.py clean --all
python3 setup.py build_ts
python3 setup.py bdist_wheel -p manylinux1_x86_64
xuanbaby's avatar
DTK-x  
xuanbaby committed
65
66
```

zhanggzh's avatar
zhanggzh committed
67
安装nni
xuanbaby's avatar
DTK-x  
xuanbaby committed
68

zhanggzh's avatar
zhanggzh committed
69
70
71
```bash
# nni的whl包会在dist文件夹生成
pip3 install ./dist/nni*
xuanbaby's avatar
DTK-x  
xuanbaby committed
72
73
```

zhanggzh's avatar
zhanggzh committed
74
### **验证安装**
xuanbaby's avatar
DTK-x  
xuanbaby committed
75

zhanggzh's avatar
zhanggzh committed
76
tensorflow
xuanbaby's avatar
DTK-x  
xuanbaby committed
77

zhanggzh's avatar
zhanggzh committed
78
79
80
81
82
```bash
nnictl create --config nni/examples/trials/mnist-tfv1/config.yml
nnictl create --config nni/examples/trials/mnist-tfv2/config.yml
```
pytorch
xuanbaby's avatar
DTK-x  
xuanbaby committed
83

zhanggzh's avatar
zhanggzh committed
84
85
86
87
```bash
nnictl create --config nni/examples/trials/mnist-pytorch/config.yml
``` 
在命令行中等待输出 INFO: Successfully started experiment!。 此消息表明 Experiment 已成功启动。 通过命令行输出的 Web UI url 来访问 Experiment 的界面。 此消息表明 Experiment 已成功启动。 通过命令行输出的 Web UI url 来访问 Experiment 的界面。
xuanbaby's avatar
DTK-x  
xuanbaby committed
88

zhanggzh's avatar
zhanggzh committed
89
## **参考**
xuanbaby's avatar
DTK-x  
xuanbaby committed
90

zhanggzh's avatar
zhanggzh committed
91
[README_ORIGIN.md](https://developer.hpccube.com/codes/aicomponent/nni/-/blob/master/README_ORIGIN.md)
xuanbaby's avatar
DTK-x  
xuanbaby committed
92
93
94
95
96


## **License**

The entire codebase is under [MIT license](LICENSE)
zhanggzh's avatar
zhanggzh committed
97