自动机器学习框架nni的案例使用
作者:互联网
nni是微软开源出来的一个自动机器学习框架
可以使机器学习调参更加便利
安装非常简单,使用pip就行
pip install nni
本次使用的是最新的版本,2.0
不过此时并不能使用,因为会出现:
https://github.com/microsoft/nni/issues/3276
解决也很简单,直接将ruamel.yaml改成ruamel_yaml
将下面路径下的内容进行编辑修改即可
vim /opt/AN/lib/python3.7/site-packages/nni/tools/nnictl/common_utils.py
vim /opt/AN/lib/python3.7/site-packages/nni/experiment/config/base.py
vim /opt/AN/lib/python3.7/site-packages/nni/tools/package_utils/__init__.py
然后就可以正常使用了
root@lizong:/opt# nnictl --help
usage: nnictl [-h] [--version]
{ss_gen,create,resume,view,update,stop,trial,experiment,platform,webui,config,log,algo,package,tensorboard,top}
...
use nnictl command to control nni experiments
positional arguments:
{ss_gen,create,resume,view,update,stop,trial,experiment,platform,webui,config,log,algo,package,tensorboard,top}
ss_gen automatically generate search space file from trial
code
create create a new experiment
resume resume a new experiment
view view a stopped experiment
update update the experiment
stop stop the experiment
trial get trial information
experiment get experiment information
platform get platform information
webui get web ui information
config get config information
log get log information
algo control nni builtin tuner, assessor and advisor
algorithms
package this argument is replaced by algo
tensorboard manage tensorboard
top monitor the experiment
optional arguments:
-h, --help show this help message and exit
--version, -v
接下来运行一下官方提供的例子:
nnictl create --config nni/examples/trials/mnist-pytorch/config.yml
注意:运行之前需要git clone
git clone -b v2.0 https://github.com.cnpmjs.org/Microsoft/nni.git
运行成功后,可以在网页上观察运行结果:
具体访问地址------运行机器ip:8080
我们可以看到,上图已经运行了48m54s了,最好的得分是99分
标签:information,nni,框架,get,--,案例,experiment,config 来源: https://blog.csdn.net/zhou_438/article/details/113872545