Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Have several agents collaborate in a multi-agent hierarchy 🤖🤝🤖","local":"have-several-agents-collaborate-in-a-multi-agent-hierarchy-","sections":[{"title":"🔍 Create a web search tool","local":"-create-a-web-search-tool","sections":[],"depth":3},{"title":"Build our multi-agent system 🤖🤝🤖","local":"build-our-multi-agent-system-","sections":[],"depth":2}],"depth":1}"> | |
| <link href="/docs/cookbook/main/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/cookbook/main/en/_app/immutable/entry/start.96b44205.js"> | |
| <link rel="modulepreload" href="/docs/cookbook/main/en/_app/immutable/chunks/scheduler.65852ee5.js"> | |
| <link rel="modulepreload" href="/docs/cookbook/main/en/_app/immutable/chunks/singletons.a64a46c3.js"> | |
| <link rel="modulepreload" href="/docs/cookbook/main/en/_app/immutable/chunks/paths.f88132ad.js"> | |
| <link rel="modulepreload" href="/docs/cookbook/main/en/_app/immutable/entry/app.e92a3d99.js"> | |
| <link rel="modulepreload" href="/docs/cookbook/main/en/_app/immutable/chunks/index.aa74147d.js"> | |
| <link rel="modulepreload" href="/docs/cookbook/main/en/_app/immutable/nodes/0.0809e592.js"> | |
| <link rel="modulepreload" href="/docs/cookbook/main/en/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/cookbook/main/en/_app/immutable/nodes/31.fdeb55c9.js"> | |
| <link rel="modulepreload" href="/docs/cookbook/main/en/_app/immutable/chunks/DocNotebookDropdown.479f4286.js"> | |
| <link rel="modulepreload" href="/docs/cookbook/main/en/_app/immutable/chunks/EditOnGithub.4eda6a96.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"Have several agents collaborate in a multi-agent hierarchy 🤖🤝🤖","local":"have-several-agents-collaborate-in-a-multi-agent-hierarchy-","sections":[{"title":"🔍 Create a web search tool","local":"-create-a-web-search-tool","sections":[],"depth":3},{"title":"Build our multi-agent system 🤖🤝🤖","local":"build-our-multi-agent-system-","sections":[],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <div class="flex space-x-1 absolute z-10 right-0 top-0"> <a href="https://colab.research.google.com/github/huggingface/cookbook/blob/multiagent_assist_improvements/notebooks/en/multiagent_web_assistant.ipynb" target="_blank"><img alt="Open In Colab" class="!m-0" src="https://colab.research.google.com/assets/colab-badge.svg"></a> </div> <h1 class="relative group"><a id="have-several-agents-collaborate-in-a-multi-agent-hierarchy-" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#have-several-agents-collaborate-in-a-multi-agent-hierarchy-"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Have several agents collaborate in a multi-agent hierarchy 🤖🤝🤖</span></h1> <p data-svelte-h="svelte-1xlqnsv"><em>Authored by: <a href="https://huggingface.co/m-ric" rel="nofollow">Aymeric Roucher</a></em></p> <blockquote data-svelte-h="svelte-uy67xy"><p>This tutorial is advanced. You should have notions from <a href="agents">this other cookbook</a> first!</p></blockquote> <p data-svelte-h="svelte-45abwn">In this notebook we will make a <strong>multi-agent web browser: an agentic system with several agents collaborating to solve problems using the web!</strong></p> <p data-svelte-h="svelte-1se9mth">It will be a simple hierarchy, using a <code>ManagedAgent</code> object to wrap the managed web search agent:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --> +----------------+ | |
| |<span class="hljs-string"> Manager agent </span>| | |
| +----------------+ | |
| |<span class="hljs-string"> | |
| _______________</span>|______________ | |
| |<span class="hljs-string"> </span>| | |
| Code interpreter +--------------------------------+ | |
| tool |<span class="hljs-string"> Managed agent </span>| | |
| |<span class="hljs-string"> +------------------+ </span>| | |
| |<span class="hljs-string"> </span>|<span class="hljs-string"> Web Search agent </span>|<span class="hljs-string"> </span>| | |
| |<span class="hljs-string"> +------------------+ </span>| | |
| |<span class="hljs-string"> </span>|<span class="hljs-string"> </span>|<span class="hljs-string"> </span>| | |
| |<span class="hljs-string"> Web Search tool </span>|<span class="hljs-string"> </span>| | |
| |<span class="hljs-string"> Visit webpage tool </span>| | |
| +--------------------------------+<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1occiln">Let’s set up this system.</p> <p data-svelte-h="svelte-uvprla">⚡️ Our agent will be powered by <a href="https://huggingface.co/meta-llama/Meta-Llama-3.1-70B-Instruct" rel="nofollow">meta-llama/Meta-Llama-3.1-70B-Instruct</a> using <code>HfApiEngine</code> class that uses HF’s Inference API: the Inference API allows to quickly and easily run any OS model.</p> <p data-svelte-h="svelte-ofrdjq">Run the line below to install the required dependencies:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->!pip install markdownify duckduckgo-search <span class="hljs-string">"git+https://github.com/huggingface/transformers.git#egg=transformers[agents]"</span> python-dotenv<!-- HTML_TAG_END --></pre></div> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> login | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> dotenv <span class="hljs-keyword">import</span> load_dotenv | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> os | |
| <span class="hljs-meta">>>> </span>load_dotenv() | |
| <span class="hljs-meta">>>> </span>login(os.getenv(<span class="hljs-string">"HUGGINGFACEHUB_API_TOKEN"</span>)) | |
| <span class="hljs-meta">>>> </span>model = <span class="hljs-string">"meta-llama/Meta-Llama-3.1-70B-Instruct"</span><!-- HTML_TAG_END --></pre></div> <pre data-svelte-h="svelte-13lw4nh">The token has not been saved to the git credentials helper. Pass `add_to_git_credential=True` in this function directly or `--add-to-git-credential` if using via `huggingface-cli` if you want to set the git credential as well. | |
| Token is valid (permission: fineGrained). | |
| Your token has been saved to /Users/aymeric/.cache/huggingface/token | |
| Login successful | |
| </pre> <h3 class="relative group"><a id="-create-a-web-search-tool" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#-create-a-web-search-tool"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>🔍 Create a web search tool</span></h3> <p data-svelte-h="svelte-1ya2chk">For web browsing, we can already use our pre-existing <a href="https://github.com/huggingface/transformers/blob/main/src/transformers/agents/search.py" rel="nofollow"><code>DuckDuckGoSearchTool</code></a> tool to provide a Google search equivalent.</p> <p data-svelte-h="svelte-n7spa8">But then we will also need to be able to peak into the page found by the <code>DuckDuckGoSearchTool</code>. | |
| To do so, we could import the library’s built-in <code>VisitWebpageTool</code>, but we will build it again to see how it’s done.</p> <p data-svelte-h="svelte-1ms2uj2">So let’s create our <code>VisitWebpageTool</code> tool from scratch using <code>markdownify</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Tool | |
| <span class="hljs-keyword">import</span> requests | |
| <span class="hljs-keyword">from</span> markdownify <span class="hljs-keyword">import</span> markdownify <span class="hljs-keyword">as</span> md | |
| <span class="hljs-keyword">from</span> requests.exceptions <span class="hljs-keyword">import</span> RequestException | |
| <span class="hljs-keyword">import</span> re | |
| <span class="hljs-keyword">class</span> <span class="hljs-title class_">VisitWebpageTool</span>(<span class="hljs-title class_ inherited__">Tool</span>): | |
| name = <span class="hljs-string">"visit_webpage"</span> | |
| description = <span class="hljs-string">"Visits a webpage at the given url and returns its content as a markdown string."</span> | |
| inputs = { | |
| <span class="hljs-string">"url"</span>: { | |
| <span class="hljs-string">"type"</span>: <span class="hljs-string">"text"</span>, | |
| <span class="hljs-string">"description"</span>: <span class="hljs-string">"The url of the webpage to visit."</span>, | |
| } | |
| } | |
| output_type = <span class="hljs-string">"text"</span> | |
| <span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, url: <span class="hljs-built_in">str</span></span>) -> <span class="hljs-built_in">str</span>: | |
| <span class="hljs-keyword">try</span>: | |
| <span class="hljs-comment"># Send a GET request to the URL</span> | |
| response = requests.get(url) | |
| response.raise_for_status() <span class="hljs-comment"># Raise an exception for bad status codes</span> | |
| <span class="hljs-comment"># Convert the HTML content to Markdown</span> | |
| markdown_content = md(response.text).strip() | |
| <span class="hljs-comment"># Remove multiple line breaks</span> | |
| markdown_content = re.sub(<span class="hljs-string">r"\n{3,}"</span>, <span class="hljs-string">"\n\n"</span>, markdown_content) | |
| <span class="hljs-keyword">return</span> markdown_content | |
| <span class="hljs-keyword">except</span> RequestException <span class="hljs-keyword">as</span> e: | |
| <span class="hljs-keyword">return</span> <span class="hljs-string">f"Error fetching the webpage: <span class="hljs-subst">{<span class="hljs-built_in">str</span>(e)}</span>"</span> | |
| <span class="hljs-keyword">except</span> Exception <span class="hljs-keyword">as</span> e: | |
| <span class="hljs-keyword">return</span> <span class="hljs-string">f"An unexpected error occurred: <span class="hljs-subst">{<span class="hljs-built_in">str</span>(e)}</span>"</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-hbvg5t">Ok, now let’s initialize and test our tool!</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-meta">>>> </span>visit_page_tool = VisitWebpageTool() | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">print</span>(visit_page_tool(<span class="hljs-string">"https://en.wikipedia.org/wiki/Hugging_Face"</span>))<!-- HTML_TAG_END --></pre></div> <pre data-svelte-h="svelte-8fvg7e">Hugging Face \- Wikipedia | |
| [Jump to content](#bodyContent) | |
| Main menu | |
| Main menu | |
| move to sidebar | |
| hide | |
| Navigation | |
| * [Main page](/wiki/Main_Page "Visit the main page [z]") | |
| * [Contents](/wiki/Wikipedia:Contents "Guides to browsing Wikipedia") | |
| * [Current events](/wiki/Portal:Current_events "Articles related to current events") | |
| * [Random article](/wiki/Special:Random "Visit a randomly selected article [x]") | |
| * [About Wikipedia](/wiki/Wikipedia:About "Learn about Wikipedia and how it works") | |
| * [Contact us](//en.wikipedia.org/wiki/Wikipedia:Contact_us "How to contact Wikipedia") | |
| * [Donate](https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&utm_medium=sidebar&utm_campaign=C13_en.wikipedia.org&uselang=en "Support us by donating to the Wikimedia Foundation") | |
| Contribute | |
| * [Help](/wiki/Help:Contents "Guidance on how to use and edit Wikipedia") | |
| * [Learn to edit](/wiki/Help:Introduction "Learn how to edit Wikipedia") | |
| * [Community portal](/wiki/Wikipedia:Community_portal "The hub for editors") | |
| * [Recent changes](/wiki/Special:RecentChanges "A list of recent changes to Wikipedia [r]") | |
| * [Upload file](/wiki/Wikipedia:File_upload_wizard "Add images or other media for use on Wikipedia") | |
| [ | |
|  | |
| ](/wiki/Main_Page) | |
| [Search](/wiki/Special:Search "Search Wikipedia [f]") | |
| Search | |
| Appearance | |
| * [Create account](/w/index.php?title=Special:CreateAccount&returnto=Hugging+Face "You are encouraged to create an account and log in; however, it is not mandatory") | |
| * [Log in](/w/index.php?title=Special:UserLogin&returnto=Hugging+Face "You're encouraged to log in; however, it's not mandatory. [o]") | |
| Personal tools | |
| * [Create account](/w/index.php?title=Special:CreateAccount&returnto=Hugging+Face "You are encouraged to create an account and log in; however, it is not mandatory") | |
| * [Log in](/w/index.php?title=Special:UserLogin&returnto=Hugging+Face "You're encouraged to log in; however, it's not mandatory. [o]") | |
| Pages for logged out editors [learn more](/wiki/Help:Introduction) | |
| * [Contributions](/wiki/Special:MyContributions "A list of edits made from this IP address [y]") | |
| * [Talk](/wiki/Special:MyTalk "Discussion about edits from this IP address [n]") | |
| Contents | |
| -------- | |
| move to sidebar | |
| hide | |
| * [(Top)](#) | |
| * [1 | |
| History](#History) | |
| * [2 | |
| Services and technologies](#Services_and_technologies) | |
| Toggle Services and technologies subsection | |
| + [2\.1 | |
| Transformers Library](#Transformers_Library) | |
| + [2\.2 | |
| Hugging Face Hub](#Hugging_Face_Hub) | |
| + [2\.3 | |
| Other libraries](#Other_libraries) | |
| * [3 | |
| See also](#See_also) | |
| * [4 | |
| References](#References) | |
| Toggle the table of contents | |
| Hugging Face | |
| ============ | |
| 18 languages | |
| * [Català](https://ca.wikipedia.org/wiki/Hugging_Face "Hugging Face – Catalan") | |
| * [Deutsch](https://de.wikipedia.org/wiki/Hugging_Face "Hugging Face – German") | |
| * [Español](https://es.wikipedia.org/wiki/Hugging_Face "Hugging Face – Spanish") | |
| * [Euskara](https://eu.wikipedia.org/wiki/Hugging_Face "Hugging Face – Basque") | |
| * [فارسی](https://fa.wikipedia.org/wiki/%D9%87%D8%A7%DA%AF%DB%8C%D9%86%DA%AF_%D9%81%DB%8C%D8%B3 "هاگینگ فیس – Persian") | |
| * [Français](https://fr.wikipedia.org/wiki/Hugging_Face "Hugging Face – French") | |
| * [한국어](https://ko.wikipedia.org/wiki/%ED%97%88%EA%B9%85_%ED%8E%98%EC%9D%B4%EC%8A%A4 "허깅 페이스 – Korean") | |
| * [Bahasa Indonesia](https://id.wikipedia.org/wiki/Hugging_Face "Hugging Face – Indonesian") | |
| * [עברית](https://he.wikipedia.org/wiki/Hugging_Face "Hugging Face – Hebrew") | |
| * [Nederlands](https://nl.wikipedia.org/wiki/Hugging_Face "Hugging Face – Dutch") | |
| * [日本語](https://ja.wikipedia.org/wiki/Hugging_Face "Hugging Face – Japanese") | |
| * [Português](https://pt.wikipedia.org/wiki/Hugging_Face "Hugging Face – Portuguese") | |
| * [Runa Simi](https://qu.wikipedia.org/wiki/Hugging_Face "Hugging Face – Quechua") | |
| * [Русский](https://ru.wikipedia.org/wiki/Hugging_Face "Hugging Face – Russian") | |
| * [Suomi](https://fi.wikipedia.org/wiki/Hugging_Face "Hugging Face – Finnish") | |
| * [Türkçe](https://tr.wikipedia.org/wiki/Hugging_Face "Hugging Face – Turkish") | |
| * [Українська](https://uk.wikipedia.org/wiki/Hugging_Face "Hugging Face – Ukrainian") | |
| * [中文](https://zh.wikipedia.org/wiki/Hugging_Face "Hugging Face – Chinese") | |
| [Edit links](https://www.wikidata.org/wiki/Special:EntityPage/Q108943604#sitelinks-wikipedia "Edit interlanguage links") | |
| * [Article](/wiki/Hugging_Face "View the content page [c]") | |
| * [Talk](/wiki/Talk:Hugging_Face "Discuss improvements to the content page [t]") | |
| English | |
| * [Read](/wiki/Hugging_Face) | |
| * [Edit](/w/index.php?title=Hugging_Face&action=edit "Edit this page [e]") | |
| * [View history](/w/index.php?title=Hugging_Face&action=history "Past revisions of this page [h]") | |
| Tools | |
| Tools | |
| move to sidebar | |
| hide | |
| Actions | |
| * [Read](/wiki/Hugging_Face) | |
| * [Edit](/w/index.php?title=Hugging_Face&action=edit "Edit this page [e]") | |
| * [View history](/w/index.php?title=Hugging_Face&action=history) | |
| General | |
| * [What links here](/wiki/Special:WhatLinksHere/Hugging_Face "List of all English Wikipedia pages containing links to this page [j]") | |
| * [Related changes](/wiki/Special:RecentChangesLinked/Hugging_Face "Recent changes in pages linked from this page [k]") | |
| * [Upload file](/wiki/Wikipedia:File_Upload_Wizard "Upload files [u]") | |
| * [Special pages](/wiki/Special:SpecialPages "A list of all special pages [q]") | |
| * [Permanent link](/w/index.php?title=Hugging_Face&oldid=1238858455 "Permanent link to this revision of this page") | |
| * [Page information](/w/index.php?title=Hugging_Face&action=info "More information about this page") | |
| * [Cite this page](/w/index.php?title=Special:CiteThisPage&page=Hugging_Face&id=1238858455&wpFormIdentifier=titleform "Information on how to cite this page") | |
| * [Get shortened URL](/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHugging_Face) | |
| * [Download QR code](/w/index.php?title=Special:QrCode&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHugging_Face) | |
| * [Wikidata item](https://www.wikidata.org/wiki/Special:EntityPage/Q108943604 "Structured data on this page hosted by Wikidata [g]") | |
| Print/export | |
| * [Download as PDF](/w/index.php?title=Special:DownloadAsPdf&page=Hugging_Face&action=show-download-screen "Download this page as a PDF file") | |
| * [Printable version](/w/index.php?title=Hugging_Face&printable=yes "Printable version of this page [p]") | |
| In other projects | |
| * [Wikimedia Commons](https://commons.wikimedia.org/wiki/Category:Hugging_Face) | |
| Appearance | |
| move to sidebar | |
| hide | |
| From Wikipedia, the free encyclopedia | |
| American software company | |
| This article is about the company. For the emoji, see [Emoji](/wiki/Emoji "Emoji"). | |
| | | This article **relies excessively on [references](/wiki/Wikipedia:Verifiability "Wikipedia:Verifiability") to [primary sources](/wiki/Wikipedia:No_original_research#Primary,_secondary_and_tertiary_sources "Wikipedia:No original research")**. Please improve this article by adding [secondary or tertiary sources](/wiki/Wikipedia:No_original_research#Primary,_secondary_and_tertiary_sources "Wikipedia:No original research"). *Find sources:* ["Hugging Face"](https://www.google.com/search?as_eq=wikipedia&q=%22Hugging+Face%22) – [news](https://www.google.com/search?tbm=nws&q=%22Hugging+Face%22+-wikipedia&tbs=ar:1) **·** [newspapers](https://www.google.com/search?&q=%22Hugging+Face%22&tbs=bkt:s&tbm=bks) **·** [books](https://www.google.com/search?tbs=bks:1&q=%22Hugging+Face%22+-wikipedia) **·** [scholar](https://scholar.google.com/scholar?q=%22Hugging+Face%22) **·** [JSTOR](https://www.jstor.org/action/doBasicSearch?Query=%22Hugging+Face%22&acc=on&wc=on) *(February 2023)* *([Learn how and when to remove this message](/wiki/Help:Maintenance_template_removal "Help:Maintenance template removal"))* | | |
| | --- | --- | | |
| Hugging Face, Inc. | |
| | | | | |
| | --- | --- | | |
| | Company type | [Private](/wiki/Privately_held_company "Privately held company") | | |
| | Industry | [Artificial intelligence](/wiki/Artificial_intelligence "Artificial intelligence"), [machine learning](/wiki/Machine_learning "Machine learning"), [software development](/wiki/Software_development "Software development") | | |
| | Founded | 2016; 8 years ago (2016) | | |
| | Headquarters | [Manhattan](/wiki/Manhattan "Manhattan"), [New York City](/wiki/New_York_City "New York City") | | |
| | Area served | Worldwide | | |
| | Key people | * Clément Delangue (CEO) * Julien Chaumond (CTO) * Thomas Wolf (CSO) | | |
| | Products | Models, datasets, spaces | | |
| | Revenue | 15,000,000 United States dollar (2022\) [Edit this on Wikidata](https://www.wikidata.org/wiki/Q108943604?uselang=en#P2139 "Edit this on Wikidata") | | |
| | Number of employees | 170 (2023\) [Edit this on Wikidata](https://www.wikidata.org/wiki/Q108943604?uselang=en#P1128 "Edit this on Wikidata") | | |
| | Website | [huggingface.co](https://huggingface.co/) | | |
| **Hugging Face, Inc.** is an American company incorporated under the [Delaware General Corporation Law](/wiki/Delaware_General_Corporation_Law "Delaware General Corporation Law")[\[1]](#cite_note-1) and based in [New York City](/wiki/List_of_tech_companies_in_the_New_York_metropolitan_area "List of tech companies in the New York metropolitan area") that develops [computation](/wiki/Computation "Computation") tools for building applications using [machine learning](/wiki/Machine_learning "Machine learning"). It is most notable for its [transformers](/wiki/Transformer_(machine_learning_model) "Transformer (machine learning model)") [library](/wiki/Software_libraries "Software libraries") built for [natural language processing](/wiki/Natural_language_processing "Natural language processing") applications and its platform that allows users to share machine learning models and [datasets](/wiki/Dataset_(machine_learning) "Dataset (machine learning)") and showcase their work. | |
| History | |
| ------- | |
| \[[edit](/w/index.php?title=Hugging_Face&action=edit§ion=1 "Edit section: History")] | |
| The company was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf in [New York City](/wiki/New_York_City "New York City"), originally as a company that developed a [chatbot](/wiki/Chatbot "Chatbot") app targeted at teenagers.[\[2]](#cite_note-:0-2) The company was named after the "hugging face" [emoji](/wiki/Emoji "Emoji").[\[2]](#cite_note-:0-2) After [open sourcing](/wiki/Open-source_software "Open-source software") the model behind the chatbot, the company [pivoted](/wiki/Lean_startup "Lean startup") to focus on being a platform for machine learning. | |
| In March 2021, Hugging Face raised US$40 million in a [Series B](/wiki/Series_B "Series B") funding round.[\[3]](#cite_note-3) | |
| On April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open [large language model](/wiki/Large_language_model "Large language model").[\[4]](#cite_note-4) In 2022, the workshop concluded with the announcement of [BLOOM](/wiki/BLOOM_(language_model) "BLOOM (language model)"), a multilingual large language model with 176 billion parameters.[\[5]](#cite_note-5)[\[6]](#cite_note-6) | |
| In December 2022, the company acquired Gradio, an open source library built for developing machine learning applications in Python.[\[7]](#cite_note-7) | |
| On May 5, 2022, the company announced its [Series C](/wiki/Series_C "Series C") funding round led by [Coatue](/wiki/Coatue_Management "Coatue Management") and [Sequoia](/wiki/Sequoia_fund "Sequoia fund").[\[8]](#cite_note-8) The company received a $2 billion valuation. | |
| On August 3, 2022, the company announced the Private Hub, an enterprise version of its public Hugging Face Hub that supports [SaaS](/wiki/Software_as_a_service "Software as a service") or [on\-premises](/wiki/On-premises_software "On-premises software") deployment.[\[9]](#cite_note-9) | |
| In February 2023, the company announced partnership with [Amazon Web Services](/wiki/Amazon_Web_Services "Amazon Web Services") (AWS) which would allow Hugging Face's products available to AWS customers to use them as the building blocks for their custom applications. The company also said the next generation of BLOOM will be run on Trainium, a proprietary [machine learning chip](/wiki/Machine_learning_hardware "Machine learning hardware") created by AWS.[\[10]](#cite_note-10)[\[11]](#cite_note-11)[\[12]](#cite_note-12) | |
| In August 2023, the company announced that it raised $235 million in a [Series D](/wiki/Series_D "Series D") funding, at a $4\.5 billion valuation. The funding was led by [Salesforce](/wiki/Salesforce "Salesforce"), and notable participation came from [Google](/wiki/Google "Google"), [Amazon](/wiki/Amazon_(company) "Amazon (company)"), [Nvidia](/wiki/Nvidia "Nvidia"), [AMD](/wiki/AMD "AMD"), [Intel](/wiki/Intel "Intel"), [IBM](/wiki/IBM "IBM"), and [Qualcomm](/wiki/Qualcomm "Qualcomm").[\[13]](#cite_note-13) | |
| In June 2024, the company announced, along with [Meta](/wiki/Meta_Platforms "Meta Platforms") and [Scaleway](/wiki/Scaleway "Scaleway"), their launch of a new AI accelerator program for European startups. This initiative aims to help startups integrate open foundation models into their products, accelerating the EU AI ecosystem. The program, based at STATION F in Paris, will run from September 2024 to February 2025\. Selected startups will receive mentoring, access to AI models and tools, and Scaleway’s computing power.[\[14]](#cite_note-14) | |
| Services and technologies | |
| ------------------------- | |
| \[[edit](/w/index.php?title=Hugging_Face&action=edit§ion=2 "Edit section: Services and technologies")] | |
| ### Transformers Library | |
| \[[edit](/w/index.php?title=Hugging_Face&action=edit§ion=3 "Edit section: Transformers Library")] | |
| The Transformers library is a [Python](/wiki/Python_(programming_language) "Python (programming language)") package that contains open\-source implementations of [transformer](/wiki/Transformer_(machine_learning_model) "Transformer (machine learning model)") models for text, image, and audio tasks. It is compatible with the [PyTorch](/wiki/PyTorch "PyTorch"), [TensorFlow](/wiki/TensorFlow "TensorFlow") and [JAX](/wiki/Google_JAX "Google JAX") [deep learning](/wiki/Deep_learning "Deep learning") libraries and includes implementations of notable models like [BERT](/wiki/BERT_(language_model) "BERT (language model)") and [GPT\-2](/wiki/GPT-2 "GPT-2").[\[15]](#cite_note-15) The library was originally called "pytorch\-pretrained\-bert"[\[16]](#cite_note-16) which was then renamed to "pytorch\-transformers" and finally "transformers." | |
| A [javascript](/wiki/JavaScript "JavaScript") version (transformers.js[\[17]](#cite_note-17)) have also been developed, allowing to run models directly in the browser. | |
| ### Hugging Face Hub | |
| \[[edit](/w/index.php?title=Hugging_Face&action=edit§ion=4 "Edit section: Hugging Face Hub")] | |
| The Hugging Face Hub is a platform (centralized [web service](/wiki/Web_service "Web service")) for hosting:[\[18]](#cite_note-18) | |
| * [Git](/wiki/Git "Git")\-based [code repositories](/wiki/Repository_(version_control) "Repository (version control)"), including discussions and pull requests for projects. | |
| * models, also with Git\-based version control; | |
| * datasets, mainly in text, images, and audio; | |
| * web applications ("spaces" and "widgets"), intended for small\-scale demos of machine learning applications. | |
| There are numerous pre\-trained models that support common tasks in different modalities, such as: | |
| * [Natural Language Processing](/wiki/Natural_language_processing "Natural language processing"): text classification, named entity recognition, question answering, language modeling, summarization, translation, multiple choice, and text generation. | |
| * [Computer Vision](/wiki/Computer_vision "Computer vision"): image classification, object detection, and segmentation. | |
| * Audio: automatic speech recognition and audio classification. | |
| ### Other libraries | |
| \[[edit](/w/index.php?title=Hugging_Face&action=edit§ion=5 "Edit section: Other libraries")] | |
| [](/wiki/File:Gradio_example.png) | |
| Gradio UI Example | |
| In addition to Transformers and the Hugging Face Hub, the Hugging Face ecosystem contains libraries for other tasks, such as [dataset processing](/wiki/Data_processing "Data processing") ("Datasets"), model evaluation ("Evaluate"), and machine learning demos ("Gradio").[\[19]](#cite_note-19) | |
| See also | |
| -------- | |
| \[[edit](/w/index.php?title=Hugging_Face&action=edit§ion=6 "Edit section: See also")] | |
| * [OpenAI](/wiki/OpenAI "OpenAI") | |
| * [Station F](/wiki/Station_F "Station F") | |
| References | |
| ---------- | |
| \[[edit](/w/index.php?title=Hugging_Face&action=edit§ion=7 "Edit section: References")] | |
| 1. **[^](#cite_ref-1)** ["Terms of Service – Hugging Face"](https://huggingface.co/terms-of-service). *huggingface.co*. Retrieved 2024\-05\-24. | |
| 2. ^ [***a***](#cite_ref-:0_2-0) [***b***](#cite_ref-:0_2-1) ["Hugging Face wants to become your artificial BFF"](https://techcrunch.com/2017/03/09/hugging-face-wants-to-become-your-artificial-bff/). *TechCrunch*. 9 March 2017\. [Archived](https://web.archive.org/web/20220925012620/https://techcrunch.com/2017/03/09/hugging-face-wants-to-become-your-artificial-bff/) from the original on 2022\-09\-25. Retrieved 2023\-09\-17. | |
| 3. **[^](#cite_ref-3)** ["Hugging Face raises $40 million for its natural language processing library"](https://techcrunch.com/2021/03/11/hugging-face-raises-40-million-for-its-natural-language-processing-library). 11 March 2021\. [Archived](https://web.archive.org/web/20230728113102/https://techcrunch.com/2021/03/11/hugging-face-raises-40-million-for-its-natural-language-processing-library/) from the original on 28 July 2023. Retrieved 5 August 2022. | |
| 4. **[^](#cite_ref-4)** ["Inside BigScience, the quest to build a powerful open language model"](https://venturebeat.com/2022/01/10/inside-bigscience-the-quest-to-build-a-powerful-open-language-model/). 10 January 2022\. [Archived](https://web.archive.org/web/20220701073233/https://venturebeat.com/2022/01/10/inside-bigscience-the-quest-to-build-a-powerful-open-language-model/) from the original on 1 July 2022. Retrieved 5 August 2022. | |
| 5. **[^](#cite_ref-5)** ["BLOOM"](https://bigscience.huggingface.co/blog/bloom). *bigscience.huggingface.co*. [Archived](https://web.archive.org/web/20221114122342/https://bigscience.huggingface.co/blog/bloom) from the original on 2022\-11\-14. Retrieved 2022\-08\-20. | |
| 6. **[^](#cite_ref-6)** ["Inside a radical new project to democratize AI"](https://www.technologyreview.com/2022/07/12/1055817/inside-a-radical-new-project-to-democratize-ai/). *MIT Technology Review*. [Archived](https://web.archive.org/web/20221204184214/https://www.technologyreview.com/2022/07/12/1055817/inside-a-radical-new-project-to-democratize-ai/) from the original on 2022\-12\-04. Retrieved 2023\-08\-25. | |
| 7. **[^](#cite_ref-7)** Nataraj, Poornima (2021\-12\-23\). ["Hugging Face Acquires Gradio, A Customizable UI Components Library For Python"](https://analyticsindiamag.com/hugging-face-acquires-gradio-a-customizable-ui-components-library-for-python/). *Analytics India Magazine*. Retrieved 2024\-01\-26. | |
| 8. **[^](#cite_ref-8)** Cai, Kenrick. ["The $2 Billion Emoji: Hugging Face Wants To Be Launchpad For A Machine Learning Revolution"](https://www.forbes.com/sites/kenrickcai/2022/05/09/the-2-billion-emoji-hugging-face-wants-to-be-launchpad-for-a-machine-learning-revolution/). *Forbes*. [Archived](https://web.archive.org/web/20221103121236/https://www.forbes.com/sites/kenrickcai/2022/05/09/the-2-billion-emoji-hugging-face-wants-to-be-launchpad-for-a-machine-learning-revolution/) from the original on 2022\-11\-03. Retrieved 2022\-08\-20. | |
| 9. **[^](#cite_ref-9)** ["Introducing the Private Hub: A New Way to Build With Machine Learning"](https://huggingface.co/blog/introducing-private-hub). *huggingface.co*. [Archived](https://web.archive.org/web/20221114122333/https://huggingface.co/blog/introducing-private-hub) from the original on 2022\-11\-14. Retrieved 2022\-08\-20. | |
| 10. **[^](#cite_ref-10)** Bass, Dina (2023\-02\-21\). ["Amazon's Cloud Unit Partners With Startup Hugging Face as AI Deals Heat Up"](https://www.bloomberg.com/news/articles/2023-02-21/amazon-s-aws-joins-with-ai-startup-hugging-face-as-chatgpt-competition-heats-up). *[Bloomberg News](/wiki/Bloomberg_News "Bloomberg News")*. [Archived](https://web.archive.org/web/20230522030130/https://www.bloomberg.com/news/articles/2023-02-21/amazon-s-aws-joins-with-ai-startup-hugging-face-as-chatgpt-competition-heats-up) from the original on 2023\-05\-22. Retrieved 2023\-02\-22. | |
| 11. **[^](#cite_ref-11)** Nellis, Stephen (2023\-02\-21\). ["Amazon Web Services pairs with Hugging Face to target AI developers"](https://www.reuters.com/technology/amazon-web-services-pairs-with-hugging-face-target-ai-developers-2023-02-21/). *Reuters*. [Archived](https://web.archive.org/web/20230530091325/https://www.reuters.com/technology/amazon-web-services-pairs-with-hugging-face-target-ai-developers-2023-02-21/) from the original on 2023\-05\-30. Retrieved 2023\-02\-22. | |
| 12. **[^](#cite_ref-12)** ["AWS and Hugging Face collaborate to make generative AI more accessible and cost efficient \| AWS Machine Learning Blog"](https://aws.amazon.com/blogs/machine-learning/aws-and-hugging-face-collaborate-to-make-generative-ai-more-accessible-and-cost-efficient/). *aws.amazon.com*. 2023\-02\-21\. [Archived](https://web.archive.org/web/20230825202343/https://aws.amazon.com/blogs/machine-learning/aws-and-hugging-face-collaborate-to-make-generative-ai-more-accessible-and-cost-efficient/) from the original on 2023\-08\-25. Retrieved 2023\-08\-25. | |
| 13. **[^](#cite_ref-13)** Leswing, Kif (2023\-08\-24\). ["Google, Amazon, Nvidia and other tech giants invest in AI startup Hugging Face, sending its valuation to $4\.5 billion"](https://www.cnbc.com/2023/08/24/google-amazon-nvidia-amd-other-tech-giants-invest-in-hugging-face.html). *CNBC*. [Archived](https://web.archive.org/web/20230824141538/https://www.cnbc.com/2023/08/24/google-amazon-nvidia-amd-other-tech-giants-invest-in-hugging-face.html) from the original on 2023\-08\-24. Retrieved 2023\-08\-24. | |
| 14. **[^](#cite_ref-14)** ["META Collaboration Launches AI Accelerator for European Startups"](https://finance.yahoo.com/news/meta-collaboration-launches-ai-accelerator-151500146.html). *Yahoo Finance*. 2024\-06\-25. Retrieved 2024\-07\-11. | |
| 15. **[^](#cite_ref-15)** ["🤗 Transformers"](https://huggingface.co/docs/transformers/index). *huggingface.co*. [Archived](https://web.archive.org/web/20230927023923/https://huggingface.co/docs/transformers/index) from the original on 2023\-09\-27. Retrieved 2022\-08\-20. | |
| 16. **[^](#cite_ref-16)** ["First release"](https://github.com/huggingface/transformers/releases/tag/v0.1.2). *GitHub*. Nov 17, 2018\. [Archived](https://web.archive.org/web/20230430011038/https://github.com/huggingface/transformers/releases/tag/v0.1.2) from the original on 30 April 2023. Retrieved 28 March 2023. | |
| 17. **[^](#cite_ref-17)** ["xenova/transformers.js"](https://github.com/xenova/transformers.js). *GitHub*. | |
| 18. **[^](#cite_ref-18)** ["Hugging Face Hub documentation"](https://huggingface.co/docs/hub/index). *huggingface.co*. [Archived](https://web.archive.org/web/20230920185949/https://huggingface.co/docs/hub/index) from the original on 2023\-09\-20. Retrieved 2022\-08\-20. | |
| 19. **[^](#cite_ref-19)** ["Hugging Face \- Documentation"](https://huggingface.co/docs). *huggingface.co*. [Archived](https://web.archive.org/web/20230930074626/https://huggingface.co/docs) from the original on 2023\-09\-30. Retrieved 2023\-02\-18. | |
| | * [v](/wiki/Template:Differentiable_computing "Template:Differentiable computing") * [t](/wiki/Template_talk:Differentiable_computing "Template talk:Differentiable computing") * [e](/wiki/Special:EditPage/Template:Differentiable_computing "Special:EditPage/Template:Differentiable computing") Differentiable computing | | | |
| | --- | --- | | |
| | [General](/wiki/Differentiable_function "Differentiable function") | * **[Differentiable programming](/wiki/Differentiable_programming "Differentiable programming")** * [Information geometry](/wiki/Information_geometry "Information geometry") * [Statistical manifold](/wiki/Statistical_manifold "Statistical manifold") * [Automatic differentiation](/wiki/Automatic_differentiation "Automatic differentiation") * [Neuromorphic engineering](/wiki/Neuromorphic_engineering "Neuromorphic engineering") * [Pattern recognition](/wiki/Pattern_recognition "Pattern recognition") * [Tensor calculus](/wiki/Tensor_calculus "Tensor calculus") * [Computational learning theory](/wiki/Computational_learning_theory "Computational learning theory") * [Inductive bias](/wiki/Inductive_bias "Inductive bias") | | |
| | Concepts | * [Gradient descent](/wiki/Gradient_descent "Gradient descent") + [SGD](/wiki/Stochastic_gradient_descent "Stochastic gradient descent") * [Clustering](/wiki/Cluster_analysis "Cluster analysis") * [Regression](/wiki/Regression_analysis "Regression analysis") + [Overfitting](/wiki/Overfitting "Overfitting") * [Hallucination](/wiki/Hallucination_(artificial_intelligence) "Hallucination (artificial intelligence)") * [Adversary](/wiki/Adversarial_machine_learning "Adversarial machine learning") * [Attention](/wiki/Attention_(machine_learning) "Attention (machine learning)") * [Convolution](/wiki/Convolution "Convolution") * [Loss functions](/wiki/Loss_functions_for_classification "Loss functions for classification") * [Backpropagation](/wiki/Backpropagation "Backpropagation") * [Batchnorm](/wiki/Batch_normalization "Batch normalization") * [Activation](/wiki/Activation_function "Activation function") + [Softmax](/wiki/Softmax_function "Softmax function") + [Sigmoid](/wiki/Sigmoid_function "Sigmoid function") + [Rectifier](/wiki/Rectifier_(neural_networks) "Rectifier (neural networks)") * [Regularization](/wiki/Regularization_(mathematics) "Regularization (mathematics)") * [Datasets](/wiki/Training,_validation,_and_test_sets "Training, validation, and test sets") + [Augmentation](/wiki/Data_augmentation "Data augmentation") * [Diffusion](/wiki/Diffusion_process "Diffusion process") * [Autoregression](/wiki/Autoregressive_model "Autoregressive model") | | |
| | Applications | * [Machine learning](/wiki/Machine_learning "Machine learning") + [In\-context learning](/wiki/Prompt_engineering#In-context_learning "Prompt engineering") * [Artificial neural network](/wiki/Artificial_neural_network "Artificial neural network") + [Deep learning](/wiki/Deep_learning "Deep learning") * [Scientific computing](/wiki/Computational_science "Computational science") * [Artificial Intelligence](/wiki/Artificial_intelligence "Artificial intelligence") * [Language model](/wiki/Language_model "Language model") + [Large language model](/wiki/Large_language_model "Large language model") | | |
| | Hardware | * [IPU](/wiki/Graphcore "Graphcore") * [TPU](/wiki/Tensor_Processing_Unit "Tensor Processing Unit") * [VPU](/wiki/Vision_processing_unit "Vision processing unit") * [Memristor](/wiki/Memristor "Memristor") * [SpiNNaker](/wiki/SpiNNaker "SpiNNaker") | | |
| | Software libraries | * [TensorFlow](/wiki/TensorFlow "TensorFlow") * [PyTorch](/wiki/PyTorch "PyTorch") * [Keras](/wiki/Keras "Keras") * [Theano](/wiki/Theano_(software) "Theano (software)") * [JAX](/wiki/Google_JAX "Google JAX") * [Flux.jl](/wiki/Flux_(machine-learning_framework) "Flux (machine-learning framework)") * [MindSpore](/wiki/MindSpore "MindSpore") | | |
| | Implementations | | Audio–visual | * [AlexNet](/wiki/AlexNet "AlexNet") * [WaveNet](/wiki/WaveNet "WaveNet") * [Human image synthesis](/wiki/Human_image_synthesis "Human image synthesis") * [HWR](/wiki/Handwriting_recognition "Handwriting recognition") * [OCR](/wiki/Optical_character_recognition "Optical character recognition") * [Speech synthesis](/wiki/Deep_learning_speech_synthesis "Deep learning speech synthesis") * [Speech recognition](/wiki/Speech_recognition "Speech recognition") * [Facial recognition](/wiki/Facial_recognition_system "Facial recognition system") * [AlphaFold](/wiki/AlphaFold "AlphaFold") * [Text\-to\-image models](/wiki/Text-to-image_model "Text-to-image model") + [DALL\-E](/wiki/DALL-E "DALL-E") + [Midjourney](/wiki/Midjourney "Midjourney") + [Stable Diffusion](/wiki/Stable_Diffusion "Stable Diffusion") * [Text\-to\-video models](/wiki/Text-to-video_model "Text-to-video model") + [Sora](/wiki/Sora_(text-to-video_model) "Sora (text-to-video model)") + [VideoPoet](/wiki/VideoPoet "VideoPoet") * [Whisper](/wiki/Whisper_(speech_recognition_system) "Whisper (speech recognition system)") | | --- | --- | | Verbal | * [Word2vec](/wiki/Word2vec "Word2vec") * [Seq2seq](/wiki/Seq2seq "Seq2seq") * [BERT](/wiki/BERT_(language_model) "BERT (language model)") * [Gemini](/wiki/Gemini_(language_model) "Gemini (language model)") * [LaMDA](/wiki/LaMDA "LaMDA") + [Bard](/wiki/Bard_(chatbot) "Bard (chatbot)") * [NMT](/wiki/Neural_machine_translation "Neural machine translation") * [Project Debater](/wiki/Project_Debater "Project Debater") * [IBM Watson](/wiki/IBM_Watson "IBM Watson") * [IBM Watsonx](/wiki/IBM_Watsonx "IBM Watsonx") * [Granite](/wiki/IBM_Granite "IBM Granite") * [GPT\-1](/wiki/GPT-1 "GPT-1") * [GPT\-2](/wiki/GPT-2 "GPT-2") * [GPT\-3](/wiki/GPT-3 "GPT-3") * [GPT\-4](/wiki/GPT-4 "GPT-4") * [ChatGPT](/wiki/ChatGPT "ChatGPT") * [GPT\-J](/wiki/GPT-J "GPT-J") * [Chinchilla AI](/wiki/Chinchilla_AI "Chinchilla AI") * [PaLM](/wiki/PaLM "PaLM") * [BLOOM](/wiki/BLOOM_(language_model) "BLOOM (language model)") * [LLaMA](/wiki/LLaMA "LLaMA") * [PanGu\-Σ](/wiki/Huawei_PanGu "Huawei PanGu") | | Decisional | * [AlphaGo](/wiki/AlphaGo "AlphaGo") * [AlphaZero](/wiki/AlphaZero "AlphaZero") * [Q\-learning](/wiki/Q-learning "Q-learning") * [SARSA](/wiki/State%E2%80%93action%E2%80%93reward%E2%80%93state%E2%80%93action "State–action–reward–state–action") * [OpenAI Five](/wiki/OpenAI_Five "OpenAI Five") * [Self\-driving car](/wiki/Self-driving_car "Self-driving car") * [MuZero](/wiki/MuZero "MuZero") * [Action selection](/wiki/Action_selection "Action selection") + [Auto\-GPT](/wiki/Auto-GPT "Auto-GPT") * [Robot control](/wiki/Robot_control "Robot control") | | | |
| | People | * [Yoshua Bengio](/wiki/Yoshua_Bengio "Yoshua Bengio") * [Alex Graves](/wiki/Alex_Graves_(computer_scientist) "Alex Graves (computer scientist)") * [Ian Goodfellow](/wiki/Ian_Goodfellow "Ian Goodfellow") * [Stephen Grossberg](/wiki/Stephen_Grossberg "Stephen Grossberg") * [Demis Hassabis](/wiki/Demis_Hassabis "Demis Hassabis") * [Geoffrey Hinton](/wiki/Geoffrey_Hinton "Geoffrey Hinton") * [Yann LeCun](/wiki/Yann_LeCun "Yann LeCun") * [Fei\-Fei Li](/wiki/Fei-Fei_Li "Fei-Fei Li") * [Andrew Ng](/wiki/Andrew_Ng "Andrew Ng") * [Jürgen Schmidhuber](/wiki/J%C3%BCrgen_Schmidhuber "Jürgen Schmidhuber") * [David Silver](/wiki/David_Silver_(computer_scientist) "David Silver (computer scientist)") * [Ilya Sutskever](/wiki/Ilya_Sutskever "Ilya Sutskever") | | |
| | Organizations | * [Anthropic](/wiki/Anthropic "Anthropic") * [EleutherAI](/wiki/EleutherAI "EleutherAI") * [Google DeepMind](/wiki/Google_DeepMind "Google DeepMind") * Hugging Face * [OpenAI](/wiki/OpenAI "OpenAI") * [Meta AI](/wiki/Meta_AI "Meta AI") * [Mila](/wiki/Mila_(research_institute) "Mila (research institute)") * [MIT CSAIL](/wiki/MIT_Computer_Science_and_Artificial_Intelligence_Laboratory "MIT Computer Science and Artificial Intelligence Laboratory") * [Huawei](/wiki/Huawei "Huawei") | | |
| | Architectures | * [Neural Turing machine](/wiki/Neural_Turing_machine "Neural Turing machine") * [Differentiable neural computer](/wiki/Differentiable_neural_computer "Differentiable neural computer") * [Transformer](/wiki/Transformer_(machine_learning_model) "Transformer (machine learning model)") * [Recurrent neural network (RNN)](/wiki/Recurrent_neural_network "Recurrent neural network") * [Long short\-term memory (LSTM)](/wiki/Long_short-term_memory "Long short-term memory") * [Gated recurrent unit (GRU)](/wiki/Gated_recurrent_unit "Gated recurrent unit") * [Echo state network](/wiki/Echo_state_network "Echo state network") * [Multilayer perceptron (MLP)](/wiki/Multilayer_perceptron "Multilayer perceptron") * [Convolutional neural network](/wiki/Convolutional_neural_network "Convolutional neural network") * [Residual neural network](/wiki/Residual_neural_network "Residual neural network") * [Mamba](/wiki/Mamba_(deep_learning) "Mamba (deep learning)") * [Autoencoder](/wiki/Autoencoder "Autoencoder") * [Variational autoencoder (VAE)](/wiki/Variational_autoencoder "Variational autoencoder") * [Generative adversarial network (GAN)](/wiki/Generative_adversarial_network "Generative adversarial network") * [Graph neural network](/wiki/Graph_neural_network "Graph neural network") | | |
| | * Portals + [Computer programming](/wiki/Portal:Computer_programming "Portal:Computer programming") + [Technology](/wiki/Portal:Technology "Portal:Technology") * Categories + [Artificial neural networks](/wiki/Category:Artificial_neural_networks "Category:Artificial neural networks") + [Machine learning](/wiki/Category:Machine_learning "Category:Machine learning") | | | |
| [Portal](/wiki/Wikipedia:Contents/Portals "Wikipedia:Contents/Portals"):*  [Companies](/wiki/Portal:Companies "Portal:Companies") | |
|  | |
| Retrieved from "[https://en.wikipedia.org/w/index.php?title\=Hugging\_Face\&oldid\=1238858455](https://en.wikipedia.org/w/index.php?title=Hugging_Face&oldid=1238858455)" | |
| [Categories](/wiki/Help:Category "Help:Category"): * [Machine learning](/wiki/Category:Machine_learning "Category:Machine learning") | |
| * [Open\-source artificial intelligence](/wiki/Category:Open-source_artificial_intelligence "Category:Open-source artificial intelligence") | |
| * [Privately held companies based in New York City](/wiki/Category:Privately_held_companies_based_in_New_York_City "Category:Privately held companies based in New York City") | |
| * [American companies established in 2016](/wiki/Category:American_companies_established_in_2016 "Category:American companies established in 2016") | |
| * [2016 establishments in New York City](/wiki/Category:2016_establishments_in_New_York_City "Category:2016 establishments in New York City") | |
| Hidden categories: * [Articles with short description](/wiki/Category:Articles_with_short_description "Category:Articles with short description") | |
| * [Short description is different from Wikidata](/wiki/Category:Short_description_is_different_from_Wikidata "Category:Short description is different from Wikidata") | |
| * [Articles lacking reliable references from February 2023](/wiki/Category:Articles_lacking_reliable_references_from_February_2023 "Category:Articles lacking reliable references from February 2023") | |
| * [All articles lacking reliable references](/wiki/Category:All_articles_lacking_reliable_references "Category:All articles lacking reliable references") | |
| * This page was last edited on 6 August 2024, at 01:57 (UTC). | |
| * Text is available under the [Creative Commons Attribution\-ShareAlike License 4\.0](//en.wikipedia.org/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License); | |
| additional terms may apply. By using this site, you agree to the [Terms of Use](//foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use) and [Privacy Policy](//foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy). Wikipedia® is a registered trademark of the [Wikimedia Foundation, Inc.](//wikimediafoundation.org/), a non\-profit organization. | |
| * [Privacy policy](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy) | |
| * [About Wikipedia](/wiki/Wikipedia:About) | |
| * [Disclaimers](/wiki/Wikipedia:General_disclaimer) | |
| * [Contact Wikipedia](//en.wikipedia.org/wiki/Wikipedia:Contact_us) | |
| * [Code of Conduct](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct) | |
| * [Developers](https://developer.wikimedia.org) | |
| * [Statistics](https://stats.wikimedia.org/#/en.wikipedia.org) | |
| * [Cookie statement](https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement) | |
| * [Mobile view](//en.m.wikipedia.org/w/index.php?title=Hugging_Face&mobileaction=toggle_view_mobile) | |
| * [](https://wikimediafoundation.org/) | |
| * [](https://www.mediawiki.org/) | |
| * | |
| </pre> <h2 class="relative group"><a id="build-our-multi-agent-system-" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#build-our-multi-agent-system-"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Build our multi-agent system 🤖🤝🤖</span></h2> <p data-svelte-h="svelte-5768lo">Now that we have all the tools <code>search</code> and <code>visit_webpage</code>, we can use them to create the web agent.</p> <p data-svelte-h="svelte-noa5rw">Which configuration to choose for this agent?</p> <ul data-svelte-h="svelte-4uouvt"><li>Web browsing is a single-timeline task that does not require parallel tool calls, so JSON tool calling works well for that. We thus choose a <code>ReactJsonAgent</code>.</li> <li>Also, since sometimes web search requires exploring many pages before finding the correct answer, we prefer to increase the number of <code>max_iterations</code> to 10.</li></ul> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">from</span> transformers.agents <span class="hljs-keyword">import</span> ( | |
| ReactCodeAgent, | |
| ReactJsonAgent, | |
| HfApiEngine, | |
| ManagedAgent, | |
| ) | |
| <span class="hljs-keyword">from</span> transformers.agents.search <span class="hljs-keyword">import</span> DuckDuckGoSearchTool | |
| llm_engine = HfApiEngine(model) | |
| web_agent = ReactJsonAgent( | |
| tools=[DuckDuckGoSearchTool(), VisitWebpageTool()], | |
| llm_engine=llm_engine, | |
| max_iterations=<span class="hljs-number">10</span>, | |
| )<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1by3x3d">We then wrap this agent into a <code>ManagedAgent</code> that will make it callable by its manager agent.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->managed_web_agent = ManagedAgent( | |
| agent=web_agent, | |
| name=<span class="hljs-string">"search_agent"</span>, | |
| description=<span class="hljs-string">"Runs web searches for you. Give it your query as an argument."</span>, | |
| )<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-12kldg5">Finally we create a manager agent, and upon initialization we pass our managed agent to it in its <code>managed_agents</code> argument.</p> <p data-svelte-h="svelte-julrcm">Since this agent is the one tasked with the planning and thinking, advanced reasoning will be beneficial, so a <code>ReactCodeAgent</code> will be the best choice.</p> <p data-svelte-h="svelte-hvhtn0">Also, we want to ask a question that involves the current year: so let us add <code>additional_authorized_imports=["time", "datetime"]</code></p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->manager_agent = ReactCodeAgent( | |
| tools=[], | |
| llm_engine=llm_engine, | |
| managed_agents=[managed_web_agent], | |
| additional_authorized_imports=[<span class="hljs-string">"time"</span>, <span class="hljs-string">"datetime"</span>], | |
| )<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1gu46sl">That’s all! Now let’s run our system! We select a question that requires some calculation and</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->manager_agent.run(<span class="hljs-string">"How many years ago was Stripe founded?"</span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-ollz3q">Our agents managed to efficiently collaborate towards solving the task! ✅</p> <p data-svelte-h="svelte-1v517hq">💡 You can easily extend this to more agents: one does the code execution, one the web search, one handles file loadings…</p> <p data-svelte-h="svelte-58qi1z">🤔💭 One could even think of doing more complex, tree-like hierarchies, with one CEO agent handling multiple middle managers, each with several reports.</p> <p data-svelte-h="svelte-9myor3">We could even add more intermediate layers of management, each with multiple daily meetings, lots of agile stuff with scrum masters, and each new component adds enough friction to ensure the tasks never get done… Ehm wait, no, let’s stick with our simple structure.</p> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/cookbook/blob/main/notebooks/en/multiagent_web_assistant.md" target="_blank"><span data-svelte-h="svelte-1kd6by1"><</span> <span data-svelte-h="svelte-x0xyl0">></span> <span data-svelte-h="svelte-1dajgef"><span class="underline ml-1.5">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_1l2350x = { | |
| assets: "/docs/cookbook/main/en", | |
| base: "/docs/cookbook/main/en", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/cookbook/main/en/_app/immutable/entry/start.96b44205.js"), | |
| import("/docs/cookbook/main/en/_app/immutable/entry/app.e92a3d99.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 31], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 69.5 kB
- Xet hash:
- 73ae7bf2ca654333b50b563adfa7f2b56fea3be727bb3ebe9611150f4a4f795c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.