Accelerate your Neural Architecture Search (NAS) through fast, reproducible and modular research.
Перейти к файлу
Chris Lovett aae38db1a5
Add Azure ML running to the face segmentation task. (#217)
* add code owners

* initial commit, beginnings of AML version of face synthetics search pipeline.

* Add download_and_extract_zip
Add download capability to FaceSyntheticsDataset
Fix face segmentation data prep script.

* fix bugs

* cleanup launch.json

* cleanup launch.json
add download capability to FaceSyntheticsDataset
add download_and_extract_zip helper

* fix file count test

* work in progress

* work in progress

* unify snpe status table and aml training table.

* fix experiment referencing

* fix experiment referencing

* work in progress

* fix complete status

* fix bugs

* fix bug

* fix metric key, we have 2, one for remote snpe, and another for aml training pipelines.

* pass seed through to the search.py script.

* fix use of AzureMLOnBehalfOfCredential

* fix bugs

* fix bugs

* publish new image

* fix bugs

* fix bugs

* fix bug

* maerge

* revert

* new version

* fix bugs

* rename the top level folder from 'snpe' to 'aml' and move all AML code into this folder except the top level entry point 'aml.py'
make the keys returned from the JobCompletionMonitor wait method configurable
Rename AmlPartialTrainingEvaluator and make it restartable.
Turn off save_pareto_model_weights
Remove redundant copy of JobCompletionMonitor

* rev the versions.

* updates to readme information.

* only inference testing targets are 'cpu' and 'snp', trigger the aml partial training by a different key in the config file.

* add iteration info

* new version.

* fix ordering of results from AmlPartialTrainingEvaluator

* change AML batch size default to 64 for faster training
don't store MODEL_STORAGE_CONNECTION_STRING

* Fix bug in merge_status_entity, add more unit test coverage

* new version

* Store training time in status table.

* improve diagram.

* save iteration in status table.

* pick up new version of archai to fix randomness bug in the EvolutionParetoSearch so that these search jobs are restartable.
2023-04-21 10:47:58 -07:00
.github remove dead code, move CI pipeline to min python 3.8 which is needed by pytorch-lightning. 2023-04-04 19:30:15 -07:00
.vscode add download capability to FaceSyntheticsDataset (#216) 2023-04-12 10:48:14 -07:00
archai Add Azure ML running to the face segmentation task. (#217) 2023-04-21 10:47:58 -07:00
confs All-No_pareto functional again 2023-01-21 02:41:49 -08:00
docker chore(docker): Adds a Dockerfile with DeepSpeed and Flash-Attention. 2023-03-20 09:55:03 -03:00
docs Add Azure ML running to the face segmentation task. (#217) 2023-04-21 10:47:58 -07:00
research/lm_eval_harness fix(research): Adds evaluate requirement. 2023-03-28 12:05:32 -03:00
scripts chore(scripts): Adds fine-tune option to DeepSpeed training script. 2023-04-04 15:59:42 -03:00
tasks Add Azure ML running to the face segmentation task. (#217) 2023-04-21 10:47:58 -07:00
tests Fix some randomness in evolutionary pareto search not coming from given seed. (#225) 2023-04-20 22:37:39 -07:00
.amltignore fix(root): Fixes typo on readme and .amltignore. 2023-01-31 15:19:00 -03:00
.gitattributes Update .gitattributes 2023-01-02 13:23:23 -03:00
.gitignore Add Azure ML running to the face segmentation task. (#217) 2023-04-21 10:47:58 -07:00
AUTHORS.md fix(root): Fixes AUTHORS extension to .md. 2023-02-13 10:04:13 -03:00
CODEOWNERS Add Azure ML running to the face segmentation task. (#217) 2023-04-21 10:47:58 -07:00
CODE_OF_CONDUCT.md Updated code of conduct, licence, security.md 2020-05-18 03:23:58 -07:00
CONTRIBUTING.md initial 2020-05-18 03:11:07 -07:00
LICENSE chore(archai): Adds updated files. 2022-12-16 16:26:45 -03:00
NOTICE.md Updated notice of cyclic cosine 2022-12-16 16:31:48 -03:00
README.md add task to readme 2023-04-06 17:57:14 -07:00
SECURITY.md chore(archai): Adds updated files. 2022-12-16 16:26:45 -03:00
pyproject.toml chore(root): Bumps version for release. 2022-12-16 16:51:13 -03:00
pytest.ini chore(tests): Adds nlp.objectives tests. 2022-12-16 18:42:03 -03:00
setup.cfg chore(scripts): Improves the modeling_codegen_flash implementation to support xFormers. 2023-04-03 16:21:59 -03:00
setup.py Add environment variable expansion to Config class and some other helpers (#218) 2023-04-16 21:42:38 -07:00

README.md

Archai logo

Archai accelerates your Neural Architecture Search (NAS) through fast, reproducible and modular research, enabling the generation of efficient deep networks for various applications.

Release version Open issues Contributors PyPI downloads License

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,
)

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 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 for more details.