自动机器学习框架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分

 看一下超参数的曲线:

运行介绍会出现:

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值