Package: archai
Archaiaccelerates your Neural Architecture Search (NAS) throughfast,reproducibleandmodularresearch, enabling the generation of efficient deep networks for various applications.Installation•Quickstart•Tasks•Documentation•SupportInstallationArchai can be installed through various methods, however, it is recommended to utilize a virtual environment such ascondaorpyenvfor optimal results.To install Archai via PyPI, the following command can be executed:pipinstallarchaiArchai requires Python 3.8+ and PyTorch 1.7.0+ to function properly.For further information, please consult theinstallation guide.QuickstartIn 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 SpaceWe start by importing theTransformerFlexSearchSpaceclass which represents the search space for the Transformer architecture:fromarchai.discrete_search.search_spaces.nlp.transformer_flex.search_spaceimportTransformerFlexSearchSpacespace=TransformerFlexSearchSpace("gpt2")Defining Search ObjectivesNext, we define the objectives we want to optimize. In this example, we useNonEmbeddingParamsProxy,TransformerFlexOnnxLatency, andTransformerFlexOnnxMemoryto define the objectives:fromarchai.discrete_search.api.search_objectivesimportSearchObjectivesfromarchai.discrete_search.evaluators.nlp.parametersimportNonEmbeddingParamsProxyfromarchai.discrete_search.evaluators.nlp.transformer_flex_latencyimportTransformerFlexOnnxLatencyfromarchai.discrete_search.evaluators.nlp.transformer_flex_memoryimportTransformerFlexOnnxMemorysearch_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 AlgorithmWe use theEvolutionParetoSearchalgorithm to conduct the search:fromarchai.discrete_search.algos.evolution_paretoimportEvolutionParetoSearchalgo=EvolutionParetoSearch(space,search_objectives,None,"tmp",num_iters=5,init_num_models=10,seed=1234,)Performing the SearchFinally, we call thesearch()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.TasksTo demonstrate and showcase the capabilities/functionalities of Archai, a set of end-to-end tasks are provided:Text Generation.Face Segmentation.DocumentationTheofficial documentationalso provides a series ofnotebooks.SupportIf 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.comWebsite:https://github.com/microsoft/archai/issuesWe welcome any questions, feedback, or suggestions you may have and look forward to hearing from you.TeamArchai has been created and maintained byShital Shah,Debadeepta Dey,Gustavo de Rosa, Caio Mendes,Piero Kauffmann,Chris Lovett, Allie Del Giorno, Mojan Javaheripi, andOfer Dekelat Microsoft Research.ContributionsThis 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, visithttps://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 theMicrosoft Open Source Code of Conduct. For more information see theCode of Conduct FAQor contactopencode@microsoft.comwith any additional questions or comments.TrademarkThis 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.LicenseThis project is released under the MIT License. Please review thefilefor more details.