NNI (Neural Network Intelligence)

用于自动化机器学习生命周期的开源 AutoML 工具包,包括特征工程、神经网络架构搜索,模型压缩以及超参调优。「An open source AutoML toolkit for automate machine learning lifecycle, including feature engineering, neural architecture search, model compression and hyper-parameter tuning.」

Github星跟踪图


English

NNI (Neural Network Intelligence) 是一个轻量但强大的工具包,帮助用户自动的进行特征工程神经网络架构搜索超参调优以及模型压缩

NNI 管理自动机器学习 (AutoML) 的 Experiment,调度运行由调优算法生成的 Trial 任务来找到最好的神经网络架构和/或超参,支持各种训练环境,如本机远程服务器OpenPAIKubeflow基于 K8S 的 FrameworkController(如,AKS 等)DLWorkspace (又称 DLTS) 和其它云服务。

使用场景

  • 想要在自己的代码、模型中试验不同的自动机器学习算法
  • 想要在不同的环境中加速运行自动机器学习。
  • 想要更容易实现或试验新的自动机器学习算法的研究员或数据科学家,包括:超参调优算法,神经网络搜索算法以及模型压缩算法。
  • 在机器学习平台中支持自动机器学习

NNI v1.6 已发布!

NNI 功能一览

NNI 提供命令行工具以及友好的 WebUI 来管理训练的 Experiment。 通过可扩展的 API,可定制自动机器学习算法和训练平台。 为了方便新用户,NNI 内置了最新的自动机器学习算法,并为流行的训练平台提供了开箱即用的支持。

下表中,包含了 NNI 的功能,同时在不断地增添新功能,也非常希望您能贡献其中。

支持的框架和库 算法 训练平台
内置
  • 支持的框架
    • PyTorch
    • Keras
    • TensorFlow
    • MXNet
    • Caffe2
    • 更多...
  • 支持的库
超参调优 神经网络架构搜索 模型压缩 特征工程(测试版) 提前终止算法
参考

安装

安装

NNI 支持并在 Ubuntu >= 16.04, macOS >= 10.14.1, 和 Windows 10 >= 1809 通过了测试。 在 python 64-bit >= 3.5 的环境中,只需要运行 pip install 即可完成安装。

Linux 或 macOS

python3 -m pip install --upgrade nni

Windows

python -m pip install --upgrade nni

如果想试试最新代码,可参考从源代码安装 NNI

Linux 和 macOS 下 NNI 系统需求参考这里 ,Windows 参考这里

注意:

  • 如果遇到任何权限问题,可添加 --user 在用户目录中安装 NNI。
  • 目前,Windows 上的 NNI 支持本机,远程和 OpenPAI 模式。 强烈推荐使用 Anaconda 或 Miniconda 在 Windows 上安装 NNI
  • 如果遇到如 Segmentation fault 等错误参考常见问题。 Windows 上的 FAQ 参考在 Windows 上使用 NNI

验证安装

以下示例基于 TensorFlow 1.x 。确保运行环境中使用的的是 ** TensorFlow 1.x**。

  • 通过克隆源代码下载示例。
    git clone -b v1.6 https://github.com/Microsoft/nni.git
  • 运行 MNIST 示例。 Linux 或 macOS
    nnictl create --config nni/examples/trials/mnist-tfv1/config.yml
    Windows
    nnictl create --config nni<span class="pl-cce">\e</span>xamples<span class="pl-cce">\t</span>rials<span class="pl-cce">\m</span>nist-tfv1<span class="pl-cce">\c</span>onfig_windows.yml
  • 在命令行中等待输出 INFO: Successfully started experiment!。 此消息表明 Experiment 已成功启动。 通过命令行输出的 Web UI url 来访问 Experiment 的界面。
<code>INFO: Starting restful server...
INFO: Successfully started Restful server!
INFO: Setting local config...
INFO: Successfully set local config!
INFO: Starting experiment...
INFO: Successfully started experiment!
-----------------------------------------------------------------------
The experiment id is egchD4qy
The Web UI urls are: http://223.255.255.1:8080   http://127.0.0.1:8080
-----------------------------------------------------------------------

You can use these commands to get more information about the experiment
-----------------------------------------------------------------------
         commands                       description

1. nnictl experiment show        show the information of experiments
2. nnictl trial ls               list all of trial jobs
3. nnictl top                    monitor the status of running experiments
4. nnictl log stderr             show stderr log content
5. nnictl log stdout             show stdout log content
6. nnictl stop                   stop an experiment
7. nnictl trial kill             kill a trial job by id
8. nnictl --help                 get help information about nnictl
-----------------------------------------------------------------------
</code>
  • 在浏览器中打开 Web UI url,可看到下图的 Experiment 详细信息,以及所有的 Trial 任务。 查看这里的更多页面。
drawing drawing

文档

贡献

本项目欢迎任何贡献和建议。 大多数贡献都需要你同意参与者许可协议(CLA),来声明你有权,并实际上授予我们有权使用你的贡献。 有关详细信息,请访问 https://cla.microsoft.com。

当你提交拉取请求时,CLA机器人会自动检查你是否需要提供CLA,并修饰这个拉取请求(例如,标签、注释)。 只需要按照机器人提供的说明进行操作即可。 CLA 只需要同意一次,就能应用到所有的代码仓库上。

该项目采用了 Microsoft 开源行为准则 。 有关详细信息,请参阅常见问题解答,如有任何疑问或意见可联系 opencode@microsoft.com

熟悉贡献协议后,即可按照 NNI 开发人员教程,创建第一个 PR:

其它代码库和参考

经作者许可的一些 NNI 用法示例和相关文档。

反馈

加入聊天组:

Gitter 微信
图片 image

相关项目

以探索先进技术和开放为目标,Microsoft Research (MSR) 还发布了一些相关的开源项目。

  • OpenPAI:作为开源平台,提供了完整的 AI 模型训练和资源管理能力,能轻松扩展,并支持各种规模的私有部署、云和混合环境。
  • FrameworkController:开源的通用 Kubernetes Pod 控制器,通过单个控制器来编排 Kubernetes 上所有类型的应用。
  • MMdnn:一个完整、跨框架的解决方案,能够转换、可视化、诊断深度神经网络模型。 MMdnn 中的 "MM" 表示 model management(模型管理),而 "dnn" 是 deep neural network(深度神经网络)的缩写。
  • SPTAG : Space Partition Tree And Graph (SPTAG) 是用于大规模向量的最近邻搜索场景的开源库。

我们鼓励研究人员和学生利用这些项目来加速 AI 开发和研究。

许可协议

代码库遵循 MIT 许可协议

主要指标

概览
名称与所有者microsoft/nni
主编程语言Python
编程语言TypeScript (语言数: 9)
平台Docker, Linux, Mac, Windows
许可证MIT License
所有者活动
创建于2018-06-01 05:51:44
推送于2024-07-03 10:55:10
最后一次提交2023-10-26 13:31:53
发布数49
最新版本名称v3.0 (发布于 )
第一版名称v0.1 (发布于 )
用户参与
星数14.2k
关注者数282
派生数1.8k
提交数3k
已启用问题?
问题数2083
打开的问题数399
拉请求数3002
打开的拉请求数18
关闭的拉请求数487
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

MIT licensed
Build Status
Issues
Bugs
Pull Requests
Version Join the chat at https://gitter.im/Microsoft/nni
Documentation Status

简体中文

NNI (Neural Network Intelligence) is a lightweight but powerful toolkit to help users automate Feature Engineering, Neural Architecture Search, Hyperparameter Tuning and Model Compression.

The tool manages automated machine learning (AutoML) experiments, dispatches and runs experiments' trial jobs generated by tuning algorithms to search the best neural architecture and/or hyper-parameters in different training environments like Local Machine, Remote Servers, OpenPAI, Kubeflow, FrameworkController on K8S (AKS etc.) and other cloud options.

Who should consider using NNI

  • Those who want to try different AutoML algorithms in their training code/model.
  • Those who want to run AutoML trial jobs in different environments to speed up search.
  • Researchers and data scientists who want to easily implement and experiement new AutoML algorithms, may it be: hyperparameter tuning algorithm, neural architect search algorithm or model compression algorithm.
  • ML Platform owners who want to support AutoML in their platform.

NNI v1.4 has been released!  

NNI capabilities in a glance

NNI provides CommandLine Tool as well as an user friendly WebUI to manage training experiements. With the extensible API, you can customize your own AutoML algorithms and training services. To make it easy for new users, NNI also provides a set of build-in stat-of-the-art AutoML algorithms and out of box support for popular training platforms.

Within the following table, we summarized the current NNI capabilities, we are gradually adding new capabilities and we'd love to have your contribution.

Installation

Install

NNI supports and is tested on Ubuntu >= 16.04, macOS >= 10.14.1, and Windows 10 >= 1809. Simply run the following pip install in an environment that has python 64-bit >= 3.5.

Linux or macOS

python3 -m pip install --upgrade nni

Windows

python -m pip install --upgrade nni

If you want to try latest code, please install NNI from source code.

For detail system requirements of NNI, please refer to here for Linux & macOS, and here for Windows.

Note:

  • If there is any privilege issue, add --user to install NNI in the user directory.
  • Currently NNI on Windows supports local, remote and pai mode. Anaconda or Miniconda is highly recommended to install NNI on Windows.
  • If there is any error like Segmentation fault, please refer to FAQ. For FAQ on Windows, please refer to NNI on Windows.

Verify installation

The following example is built on TensorFlow 1.x. Make sure TensorFlow 1.x is used when running it.

  • Download the examples via clone the source code.

    git clone -b v1.4 https://github.com/Microsoft/nni.git
    
  • Run the MNIST example.

    Linux or macOS

    nnictl create --config nni/examples/trials/mnist-tfv1/config.yml
    

    Windows

    nnictl create --config nni\examples\trials\mnist-tfv1\config_windows.yml
    
  • Wait for the message INFO: Successfully started experiment! in the command line. This message indicates that your experiment has been successfully started. You can explore the experiment using the Web UI url.

INFO: Starting restful server...
INFO: Successfully started Restful server!
INFO: Setting local config...
INFO: Successfully set local config!
INFO: Starting experiment...
INFO: Successfully started experiment!
-----------------------------------------------------------------------
The experiment id is egchD4qy
The Web UI urls are: http://223.255.255.1:8080   http://127.0.0.1:8080
-----------------------------------------------------------------------

You can use these commands to get more information about the experiment
-----------------------------------------------------------------------
         commands                       description
1. nnictl experiment show        show the information of experiments
2. nnictl trial ls               list all of trial jobs
3. nnictl top                    monitor the status of running experiments
4. nnictl log stderr             show stderr log content
5. nnictl log stdout             show stdout log content
6. nnictl stop                   stop an experiment
7. nnictl trial kill             kill a trial job by id
8. nnictl --help                 get help information about nnictl
-----------------------------------------------------------------------
  • Open the Web UI url in your browser, you can view detail information of the experiment and all the submitted trial jobs as shown below. Here are more Web UI pages.

Documentation

  • To learn about what's NNI, read the NNI Overview.
  • To get yourself familiar with how to use NNI, read the documentation.
  • To get started and install NNI on your system, please refer to Install NNI.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

After getting familiar with contribution agreements, you are ready to create your first PR =), follow the NNI developer tutorials to get start:

External Repositories and References

With authors' permission, we listed a set of NNI usage examples and relevant articles.

Feedback

Targeting at openness and advancing state-of-art technology, Microsoft Research (MSR) had also released few other open source projects.

  • OpenPAI : an open source platform that provides complete AI model training and resource management capabilities, it is easy to extend and supports on-premise, cloud and hybrid environments in various scale.
  • FrameworkController : an open source general-purpose Kubernetes Pod Controller that orchestrate all kinds of applications on Kubernetes by a single controller.
  • MMdnn : A comprehensive, cross-framework solution to convert, visualize and diagnose deep neural network models. The "MM" in MMdnn stands for model management and "dnn" is an acronym for deep neural network.
  • SPTAG : Space Partition Tree And Graph (SPTAG) is an open source library for large scale vector approximate nearest neighbor search scenario.

We encourage researchers and students leverage these projects to accelerate the AI development and research.

License

The entire codebase is under MIT license