archai

microsoftMIT活跃维护

微软开源的神经架构搜索(NAS)研究框架,提供快速、可复现、模块化的实验流程,帮你在 PyTorch 上跑 DARTS、Petridish 等 NAS 算法并做超参优化与模型压缩。

Accelerate your Neural Architecture Search (NAS) through fast, reproducible and modular research.

v1.0.0发布于 2023-09-15 18:08 UTC490star +2 / 7 天96fork同步于 2026-11-11 11:56 UTC

怎么上手

由 README 提炼,执行前请确认
pip install archai
硬件要求按 README 说明

README 未说明具体显存或 GPU 型号要求,仅要求 Python 3.8+ 与 PyTorch 1.7.0+

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

微软开源的神经架构搜索框架,帮你快速可复现地搜出高效深度网络

微软开源的神经架构搜索(NAS)研究框架,提供快速、可复现、模块化的实验流程,帮你在 PyTorch 上跑 DARTS、Petridish 等 NAS 算法并做超参优化与模型压缩。

核心能力

  • 用 EvolutionParetoSearch 做多目标帕累托前沿搜索
  • 内置 TransformerFlexSearchSpace 等离散搜索空间
  • 可组合参数量、ONNX 延迟与显存等搜索目标
  • 提供文本生成与人脸分割端到端示例任务
  • 模块化设计便于自定义搜索空间与评估器

容易踩的坑

需自行准备 Python 3.8+ 与 PyTorch 1.7.0+ 环境,建议用 conda 或 pyenv 虚拟环境;示例以 gpt2 为搜索空间基础,需能获取对应预训练模型;ONNX 延迟与显存评估依赖 ONNX 相关运行时,README 未说明需额外安装

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

3 个版本v1.0.0
  1. v1.0.0最新正式版2023-09-15 · 2023-09-15 18:08 UTC

    What's Changed

    Datasets

    Dependencies, Documentation, Examples and Tests

    New Contributors

    Full Changelog: https://github.com/microsoft/archai/compare/v0.6.9...v1.0.0

  2. v0.7.02023-01-18 · 2023-01-18 13:25 UTC
    查看更新说明
  3. v0.6.92023-01-18 · 2023-01-18 13:25 UTC
    查看更新说明

    New Contributors

    Full Changelog: https://github.com/microsoft/archai/compare/v0.6.8...v0.6.9

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Installation

    Archai can be installed through various methods, however, it is recommended to utilize a virtual environment such as conda or pyenv for optimal results.

    To install Archai via PyPI, the following command can be executed:

    pip install archai
    

    Archai requires Python 3.8+ and PyTorch 1.7.0+ to function properly.

    For further information, please consult the installation guide.

    Quickstart

    In this quickstart example, we will apply Archai in Natural Language Processing to find the optimal Pareto-frontier Transformers' configurations according to a set of objectives.

    Creating the Search Space

    We start by importing the TransformerFlexSearchSpace class which represents the search space for the Transformer architecture:

    from archai.discrete_search.search_spaces.nlp.transformer_flex.search_space import TransformerFlexSearchSpace
    
    space = TransformerFlexSearchSpace("gpt2")
    

    Defining Search Objectives

    Next, we define the objectives we want to optimize. In this example, we use NonEmbeddingParamsProxy, TransformerFlexOnnxLatency, and TransformerFlexOnnxMemory to define the objectives:

    from archai.discrete_search.api.search_objectives import SearchObjectives
    from archai.discrete_search.evaluators.nlp.parameters import NonEmbeddingParamsProxy
    from archai.discrete_search.evaluators.nlp.transformer_flex_latency import TransformerFlexOnnxLatency
    from archai.discrete_search.evaluators.nlp.transformer_flex_memory import TransformerFlexOnnxMemory
    
    search_objectives = SearchObjectives()
    search_objectives.add_objective(
       "non_embedding_params",
       NonEmbeddingParamsProxy(),
       higher_is_better=True,
       compute_intensive=False,
       constraint=(1e6, 1e9),
    )
    search_objectives.add_objective(
       "onnx_latency",
       TransformerFlexOnnxLatency(space),
       higher_is_better=False,
       compute_intensive=False,
    )
    search_objectives.add_objective(
       "onnx_memory",
       TransformerFlexOnnxMemory(space),
       higher_is_better=False,
       compute_intensive=False,
    )
    

    Initializing the Algorithm

    We use the EvolutionParetoSearch algorithm to conduct the search:

    from archai.discrete_search.algos.evolution_pareto import EvolutionParetoSearch
    
    algo = EvolutionParetoSearch(
       space,
       search_objectives,
       None,
       "tmp",
       num_iters=5,
       init_num_models=10,
       seed=1234,
    )
    

    Performing the Search

    Finally, we call the search() method to start the NAS process:

    algo.search()
    

    The algorithm will iterate through different network architectures, evaluate their performance based on the defined objectives, and ultimately produce a frontier of Pareto-optimal results.

    Tasks

    To demonstrate and showcase the capabilities/functionalities of Archai, a set of end-to-end tasks are provided:

    Documentation

    The official documentation also provides a series of notebooks.

    Support

    If you have any questions or feedback about the Archai project or the open problems in Neural Architecture Search, please feel free to contact us using the following information:

    We welcome any questions, feedback, or suggestions you may have and look forward to hearing from you.

    Team

    Archai has been created and maintained by Shital Shah, Debadeepta Dey, Gustavo de Rosa, Caio Mendes, Piero Kauffmann, Chris Lovett, Allie Del Giorno, Mojan Javaheripi, and Ofer Dekel at Microsoft Research.

    Contributions

    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 repositories 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 [email protected] with any additional questions or comments.

    Trademark

    This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

    License

    This project is released under the MIT License. Please review the file for more details.