archai


Namearchai JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/microsoft/archai
SummaryPlatform for Neural Architecture Search
upload_time2023-09-15 18:08:52
maintainer
docs_urlNone
authorMicrosoft
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">
   <img src="https://user-images.githubusercontent.com/9354770/171523113-70c7214b-8298-4d7e-abd9-81f5788f6e19.png" alt="Archai logo" width="384px" />
   <br />
</h1>

<div align="center">
   <b>Archai</b> accelerates your Neural Architecture Search (NAS) through <b>fast</b>, <b>reproducible</b> and <b>modular</b> research, enabling the generation of efficient deep networks for various applications.
</div>

<br />

<div align="center">
	<img src ="https://img.shields.io/github/release/microsoft/archai?style=flat-square" alt="Release version" />
	<img src ="https://img.shields.io/github/issues-raw/microsoft/archai?style=flat-square" alt="Open issues" />
	<img src ="https://img.shields.io/github/contributors/microsoft/archai?style=flat-square" alt="Contributors" />
	<img src ="https://img.shields.io/pypi/dm/archai?style=flat-square" alt="PyPI downloads" />
	<img src ="https://img.shields.io/github/license/microsoft/archai?color=red&style=flat-square" alt="License" />
</div>

<br />

<div align="center">
   <a href="#installation">Installation</a> •
   <a href="#quickstart">Quickstart</a> •
   <a href="#tasks">Tasks</a> •
   <a href="#documentation">Documentation</a> •
   <a href="#support">Support</a>
</div>

## 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:

```bash
pip install archai
```

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

For further information, please consult the [installation guide](https://microsoft.github.io/archai/getting_started/installation.html).


## 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:

```python
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:

```python
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:

```python
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:

```python
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:

* [Text Generation](https://github.com/microsoft/archai/blob/main/tasks/text_generation).
* [Face Segmentation](https://github.com/microsoft/archai/blob/main/tasks/face_segmentation).

## Documentation

The [official documentation](https://microsoft.github.io/archai) also provides a series of [notebooks](https://microsoft.github.io/archai/getting_started/notebooks.html).

## 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:

* Email: archai@microsoft.com
* Website: https://github.com/microsoft/archai/issues

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](https://shital.com), [Debadeepta Dey](https://debadeepta.com), [Gustavo de Rosa](https://www.microsoft.com/en-us/research/people/gderosa), Caio Mendes, [Piero Kauffmann](https://www.microsoft.com/en-us/research/people/pkauffmann), [Chris Lovett](https://lovettsoftware.com), Allie Del Giorno, Mojan Javaheripi, and [Ofer Dekel](https://www.microsoft.com/en-us/research/people/oferd) 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](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) 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](https://github.com/microsoft/archai/blob/main/LICENSE) for more details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/microsoft/archai",
    "name": "archai",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Microsoft",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/4f/0a/bce59a90fe915b8017e509be278417ceffb0f5be264d9302d8004b0a5957/archai-1.0.0.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">\n   <img src=\"https://user-images.githubusercontent.com/9354770/171523113-70c7214b-8298-4d7e-abd9-81f5788f6e19.png\" alt=\"Archai logo\" width=\"384px\" />\n   <br />\n</h1>\n\n<div align=\"center\">\n   <b>Archai</b> accelerates your Neural Architecture Search (NAS) through <b>fast</b>, <b>reproducible</b> and <b>modular</b> research, enabling the generation of efficient deep networks for various applications.\n</div>\n\n<br />\n\n<div align=\"center\">\n\t<img src =\"https://img.shields.io/github/release/microsoft/archai?style=flat-square\" alt=\"Release version\" />\n\t<img src =\"https://img.shields.io/github/issues-raw/microsoft/archai?style=flat-square\" alt=\"Open issues\" />\n\t<img src =\"https://img.shields.io/github/contributors/microsoft/archai?style=flat-square\" alt=\"Contributors\" />\n\t<img src =\"https://img.shields.io/pypi/dm/archai?style=flat-square\" alt=\"PyPI downloads\" />\n\t<img src =\"https://img.shields.io/github/license/microsoft/archai?color=red&style=flat-square\" alt=\"License\" />\n</div>\n\n<br />\n\n<div align=\"center\">\n   <a href=\"#installation\">Installation</a> \u2022\n   <a href=\"#quickstart\">Quickstart</a> \u2022\n   <a href=\"#tasks\">Tasks</a> \u2022\n   <a href=\"#documentation\">Documentation</a> \u2022\n   <a href=\"#support\">Support</a>\n</div>\n\n## Installation\n\nArchai can be installed through various methods, however, it is recommended to utilize a virtual environment such as `conda` or `pyenv` for optimal results.\n\nTo install Archai via PyPI, the following command can be executed:\n\n```bash\npip install archai\n```\n\n**Archai requires Python 3.8+ and PyTorch 1.7.0+ to function properly.**\n\nFor further information, please consult the [installation guide](https://microsoft.github.io/archai/getting_started/installation.html).\n\n\n## Quickstart\n\nIn 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.\n\n### Creating the Search Space\n\nWe start by importing the `TransformerFlexSearchSpace` class which represents the search space for the Transformer architecture:\n\n```python\nfrom archai.discrete_search.search_spaces.nlp.transformer_flex.search_space import TransformerFlexSearchSpace\n\nspace = TransformerFlexSearchSpace(\"gpt2\")\n```\n\n### Defining Search Objectives\n\nNext, we define the objectives we want to optimize. In this example, we use `NonEmbeddingParamsProxy`, `TransformerFlexOnnxLatency`, and `TransformerFlexOnnxMemory` to define the objectives:\n\n```python\nfrom archai.discrete_search.api.search_objectives import SearchObjectives\nfrom archai.discrete_search.evaluators.nlp.parameters import NonEmbeddingParamsProxy\nfrom archai.discrete_search.evaluators.nlp.transformer_flex_latency import TransformerFlexOnnxLatency\nfrom archai.discrete_search.evaluators.nlp.transformer_flex_memory import TransformerFlexOnnxMemory\n\nsearch_objectives = SearchObjectives()\nsearch_objectives.add_objective(\n   \"non_embedding_params\",\n   NonEmbeddingParamsProxy(),\n   higher_is_better=True,\n   compute_intensive=False,\n   constraint=(1e6, 1e9),\n)\nsearch_objectives.add_objective(\n   \"onnx_latency\",\n   TransformerFlexOnnxLatency(space),\n   higher_is_better=False,\n   compute_intensive=False,\n)\nsearch_objectives.add_objective(\n   \"onnx_memory\",\n   TransformerFlexOnnxMemory(space),\n   higher_is_better=False,\n   compute_intensive=False,\n)\n```\n\n### Initializing the Algorithm\n\nWe use the `EvolutionParetoSearch` algorithm to conduct the search:\n\n```python\nfrom archai.discrete_search.algos.evolution_pareto import EvolutionParetoSearch\n\nalgo = EvolutionParetoSearch(\n   space,\n   search_objectives,\n   None,\n   \"tmp\",\n   num_iters=5,\n   init_num_models=10,\n   seed=1234,\n)\n```\n\n### Performing the Search\n\nFinally, we call the `search()` method to start the NAS process:\n\n```python\nalgo.search()\n```\n\nThe algorithm will iterate through different network architectures, evaluate their performance based on the defined objectives, and ultimately produce a frontier of Pareto-optimal results.\n\n## Tasks\n\nTo demonstrate and showcase the capabilities/functionalities of Archai, a set of end-to-end tasks are provided:\n\n* [Text Generation](https://github.com/microsoft/archai/blob/main/tasks/text_generation).\n* [Face Segmentation](https://github.com/microsoft/archai/blob/main/tasks/face_segmentation).\n\n## Documentation\n\nThe [official documentation](https://microsoft.github.io/archai) also provides a series of [notebooks](https://microsoft.github.io/archai/getting_started/notebooks.html).\n\n## Support\n\nIf 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:\n\n* Email: archai@microsoft.com\n* Website: https://github.com/microsoft/archai/issues\n\nWe welcome any questions, feedback, or suggestions you may have and look forward to hearing from you.\n\n### Team\n\nArchai has been created and maintained by [Shital Shah](https://shital.com), [Debadeepta Dey](https://debadeepta.com), [Gustavo de Rosa](https://www.microsoft.com/en-us/research/people/gderosa), Caio Mendes, [Piero Kauffmann](https://www.microsoft.com/en-us/research/people/pkauffmann), [Chris Lovett](https://lovettsoftware.com), Allie Del Giorno, Mojan Javaheripi, and [Ofer Dekel](https://www.microsoft.com/en-us/research/people/oferd) at Microsoft Research.\n\n### Contributions\n\nThis 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.\n\nWhen 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.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n### Trademark\n\nThis 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.\n\n### License\n\nThis project is released under the MIT License. Please review the [file](https://github.com/microsoft/archai/blob/main/LICENSE) for more details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Platform for Neural Architecture Search",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/microsoft/archai"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "66ec7de6f8ebe74b568d73d3897694d1e465f18fd56dda4dffdaab6f1ce62f66",
                "md5": "cef6cec12cce1e84fb772ee10c32917c",
                "sha256": "86628c12a820eb42284b331c4bfe7bdd6494046d85d03864d82b114470c26c9b"
            },
            "downloads": -1,
            "filename": "archai-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cef6cec12cce1e84fb772ee10c32917c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 587187,
            "upload_time": "2023-09-15T18:08:50",
            "upload_time_iso_8601": "2023-09-15T18:08:50.364093Z",
            "url": "https://files.pythonhosted.org/packages/66/ec/7de6f8ebe74b568d73d3897694d1e465f18fd56dda4dffdaab6f1ce62f66/archai-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4f0abce59a90fe915b8017e509be278417ceffb0f5be264d9302d8004b0a5957",
                "md5": "5abbafa891ae4ac86395488ba51eeb41",
                "sha256": "24d42a8d9e558aa9495918de84b408068f11feca8159214226b5585debd59faf"
            },
            "downloads": -1,
            "filename": "archai-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5abbafa891ae4ac86395488ba51eeb41",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 425173,
            "upload_time": "2023-09-15T18:08:52",
            "upload_time_iso_8601": "2023-09-15T18:08:52.118580Z",
            "url": "https://files.pythonhosted.org/packages/4f/0a/bce59a90fe915b8017e509be278417ceffb0f5be264d9302d8004b0a5957/archai-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-15 18:08:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "microsoft",
    "github_project": "archai",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "archai"
}
        
Elapsed time: 0.10672s