


AutoGPT by hand! Let ChatGPT choose 100,000+ AI models, officially produced by HuggingFace
Some time ago, HuggingGPT proposed by the Microsoft team of Zhejiang University became popular in the entire technology circle.
This large model collaboration system uses ChatGPT as the controller to call various models in HuggingFace at will to achieve multi-modal tasks.
Letting ChatGPT be the “boss” has become a direction that many people are optimistic about.
No, what is supposed to come is coming...
"Transformers" is officially produced by HuggingFace, the world's most popular AI community Agent" can also achieve magic by controlling more than 100,000 AIs.
Nvidia scientist Jim Fan praised this as the first step towards the Everything App, and as the ecosystem expands, its capabilities Also growing.
He continued that HuggingGPT is the first large-scale demonstration of this idea. It uses GPT as a controller to dynamically select tools (models) to solve multi-stage tasks.
ChatGPT’s “App Store” is of course an example of an AI tool ecosystem application. The new Transformers Agent allows you to have super buffs and quickly build AI agents.
Transformers, omnipotent
Using Transformers Agent, you can open your mouth to draw pictures, and you can also have it read out for you.
Let’s take a look at a few examples~
<code>agent.run("Caption the following image", image=image)</code>
The first one starts with the simple one . Enter a picture and add a description, a cute beaver swimming in the water (super cute, think rua).
<code>agent.run("Read the following text out loud", text=text)</code>
The second one is not difficult, just convert text to speech.
<code>agent.run("In the following `document`, where will the TRRF Scientific Advisory Council Meeting take place?",document=document,)</code>
This is a bit more difficult. The requirement for input is to say where the Scientific Advisory Committee meetings will be held.
Of course, for AI, retrieving the last line also finds the answer.
Before using agent.run, users need to instantiate an agent, which is a large language model (LLM).
Researchers provide support for OpenAI models, as well as open source alternatives from BigCode and OpenAssistant.
Although OpenAI's model performance is better, users must have an OpenAI API key, so it is not free to use.
Hugging Face said it is providing free access endpoints for models such as BigCode and OpenAssistant.
First, users need to install the agent add-on.
<code>pip install transformers[agents]</code>
To use the OpenAI model, the user needs to instantiate an OpenAiAgent after installing the OpenAI dependency:
<code>pip install openaifrom transformers import OpenAiAgentagent = OpenAiAgent(model="text-davinci-003", api_key="<your_api_key>")</your_api_key></code>
The user needs to use BigCode Or OpenAssistant, you must log in first to be able to access the API:
<code>from huggingface_hub import loginlogin("<your_token>")</your_token></code>
Then, instantiate the agent:
<code>from transformers import HfAgent# Starcoderagent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder")# StarcoderBase# agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoderbase")# OpenAssistant# agent = HfAgent(url_endpoint="https://api-inference.huggingface.co/models/OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5")</code>
This is Use the inference API currently provided by Hugging Face for free. If the user has their own inference endpoint, they can replace the above URL.
StarCoder and OpenAssistant are free to use and perform well on simple tasks.
然而,在处理更复杂的提示时,检查点就不成立了。如果用户面临这样的问题,可以尝试一下OpenAI模型,虽然很遗憾它不是开源的,但胜在表现不错。
单一执行方法是在使用代理的run()方法时使用的:
<code>agent.run("Draw me a picture of rivers and lakes.")</code>
它自动选择适合你要执行的任务的工具(或工具)并适当地运行它们。它可以在同一指令中执行一个或几个任务(你的指令越复杂,就越有可能失败)。
<code>agent.run("Draw me a picture of the sea then transform the picture to add an island")</code>
每个run()操作都是独立的,所以你可以用不同的任务连续运行几次。
请注意,用户的智能体只是一个大语言模型,所以prompt中的小变化可能产生完全不同的结果。尽可能清楚地解释要执行的任务是很重要的。
研究人员深入地讨论了如何写出更好的prompt。
如果你想在整个执行过程中保持一个状态,或者向智能体传递非文本对象,你可以通过指定变量来做到这一点。
例如,你可以生成第一张河流和湖泊的图片,并要求模型通过以下方式更新该图片以增加一个岛屿:
<code>picture = agent.run("Generate a picture of rivers and lakes.")updated_picture = agent.run("Transform the image in `picture` to add an island to it.", picture=picture)agent.chat("Generate a picture of rivers and lakes")</code>
这里让系统生成一张河流湖泊的照片。
<code>agent.chat("Transform the picture so that there is a rock in there")</code>
下一步,研究人员又让系统给原图中加一个岛屿。
当用户想保持跨指令的状态时,这是一个很有趣的方法。
它更适合于实验,但往往在单条指令而不是复杂指令方面会好很多。
如果你想传递非文本类型或特定的提示,这个方法也可以接受参数。
要了解如何自己设置远程执行器工具,研究人员建议用户阅读自定义工具指南。
为了与远程工具一起运行,在run()或chat()中指定remote=True就可以了。
例如,以下命令可以在任何设备上有效地运行,不需要大量的RAM或GPU:
<code>agent.run("Draw me a picture of rivers and lakes", remote=True)</code>
对chat()来说也是一样的:
<code>agent.chat("Draw me a picture of rivers and lakes", remote=True)</code>
网友表示,Transformers Agent就像AutoGPT一样。
还有人表示,Transformers Agent打开了自然语言编程的大门,可以想象,未来的操作系统就是智能模型,人类通过自然语言编排任务,越来越多的非开发者可以自己实现各种计算机应用。
什么是工具?什么是智能体?
Transformers Agents整体的运作流程简单分为四步:
设定目标、提供工具、展示示例、下达任务。
智能体会使用链式思考推理来确定其任务,并用提供的工具输出Python代码。
如何安装和使用,官方给出了具体步骤。
https://www.php.cn/link/e4f67a0e4293245fba713c412fc63e28
其中,这里的「智能体」指的是,一个大型语言模型。通过提示LLM,让其访问特定的一组工具。
因为LLM非常擅长生成较小的代码样本,所以API利用了这一点优势。
你可以用抱抱脸自家的OpenAssistant、StarCoder,甚至还可以用OpenAI的模型。
提示LLM给出一个小的代码样本,并用一组工具执行一个任务。这个提示包括,给智能体的任务,以及工具的描述。
这样,「智能体」就可以找到所使用工具的文档,特别是预期的输入和输出,并可以生成相关的代码。
而「工具」就非常好理解,是一个单独的函数,带有名称和描述。
然后,使用这些工具的描述来提示「智能体」,作用就在于可以像智能体展示如何用工具来执行查询中的请求内容。
再之后,通过利用Python解释器在与工具一起上传的一组输入中执行代码。
如果唯一调用的函数是你自己提供的工具和print函数,那么,开发者会在可执行内容上受到限制。当然了,抱抱脸社区的工具,是比较安全的。
除此之外,HuggingFace在Transformers Agents中还集成了以下工具:
- 文档问答:给定一个图像格式的文档(PDF),回答文档的问题(Donut)
- 文本问答:给定一个长文本和一个问题,回答文本中的问题(Flan-T5)
- 无条件给图像加标题:(BLIP)
- 图像问答:给定一个图像,回答关于这个图像的问题(VILT)
- 图像分割:给定一个图像和一个提示,输出该提示的分割掩码(CLIPSeg)
- 语音转文本:给定一个音频记录,将语音转录为文本(Whisper)
- 文本到语音:将文本转换为语音(SpeechT5)
- 零样本文本分类:给定一个文本和一列标签,确定该文本与哪个标签最对应(BART)
- 文本总结:用一个或几个句子来总结一个长文本(BART)
- 翻译:将文本翻译成一种语言(NLLB)
这些工具都内置在Transformers中,也可以手动使用,比如:
<code>from transformers import load_tooltool = load_tool("text-to-speech")audio = tool("This is a text to speech tool")</code>
此外,还有一些定制的工具集成在Transformers Agents中,其中包括文本下载器、文本到图像的扩散模型stable diffusion、图像变换instruct pix2pix stable diffusion,以及文本到视频damo-vilab。
官方给出了一个自定义工具和提示的教程:
https://www.php.cn/link/735a8b95123648555736192cd3978bc1
代码生成
如上,已经展示了如何使用Transformers Agents流程。
但是,智能体只生成代码,通过使用非常受限的Python解释器执行这些代码。
如果你希望使用在不同设置中生成的代码,可以提示智能体返回代码,对工具定义,并准确导入。
比如,根据以下步骤实现:
<code>agent.run("Draw me a picture of rivers and lakes", return_code=True)</code>
返回以下代码:
<code>from transformers import load_toolimage_generator = load_tool("huggingface-tools/text-to-image")image = image_generator(prompt="rivers and lakes")</code>
然后,你就可以修改和执行自己的工具了。
The above is the detailed content of AutoGPT by hand! Let ChatGPT choose 100,000+ AI models, officially produced by HuggingFace. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



In the volatile cryptocurrency market, investors are looking for alternatives that go beyond popular currencies. Although well-known cryptocurrencies such as Solana (SOL), Cardano (ADA), XRP and Dogecoin (DOGE) also face challenges such as market sentiment, regulatory uncertainty and scalability. However, a new emerging project, RexasFinance (RXS), is emerging. It does not rely on celebrity effects or hype, but focuses on combining real-world assets (RWA) with blockchain technology to provide investors with an innovative way to invest. This strategy makes it hoped to be one of the most successful projects of 2025. RexasFi

Binance is the overlord of the global digital asset trading ecosystem, and its characteristics include: 1. The average daily trading volume exceeds $150 billion, supports 500 trading pairs, covering 98% of mainstream currencies; 2. The innovation matrix covers the derivatives market, Web3 layout and education system; 3. The technical advantages are millisecond matching engines, with peak processing volumes of 1.4 million transactions per second; 4. Compliance progress holds 15-country licenses and establishes compliant entities in Europe and the United States.

The top exchanges include: 1. Binance, the world's largest trading volume, supports 600 currencies, and the spot handling fee is 0.1%; 2. OKX, a balanced platform, supports 708 trading pairs, and the perpetual contract handling fee is 0.05%; 3. Gate.io, covers 2700 small currencies, and the spot handling fee is 0.1%-0.3%; 4. Coinbase, the US compliance benchmark, the spot handling fee is 0.5%; 5. Kraken, the top security, and regular reserve audit.

Exchanges play a vital role in today's cryptocurrency market. They are not only platforms for investors to trade, but also important sources of market liquidity and price discovery. The world's largest virtual currency exchanges rank among the top ten, and these exchanges are not only far ahead in trading volume, but also have their own advantages in user experience, security and innovative services. Exchanges that top the list usually have a large user base and extensive market influence, and their trading volume and asset types are often difficult to reach by other exchanges.

Global Assets launches a new AI intelligent trading system to lead the new era of trading efficiency! The well-known comprehensive trading platform Global Assets officially launched its AI intelligent trading system, aiming to use technological innovation to improve global trading efficiency, optimize user experience, and contribute to the construction of a safe and reliable global trading platform. The move marks a key step for global assets in the field of smart finance, further consolidating its global market leadership. Opening a new era of technology-driven and open intelligent trading. Against the backdrop of in-depth development of digitalization and intelligence, the trading market's dependence on technology is increasing. The AI intelligent trading system launched by Global Assets integrates cutting-edge technologies such as big data analysis, machine learning and blockchain, and is committed to providing users with intelligent and automated trading services to effectively reduce human factors.

After ETH upgrade, novices should adopt the following strategies to avoid losses: 1. Do their homework and understand the basic knowledge and upgrade content of ETH; 2. Control positions, test the waters in small amounts and diversify investment; 3. Make a trading plan, clarify goals and set stop loss points; 4. Profil rationally and avoid emotional decision-making; 5. Choose a formal and reliable trading platform; 6. Consider long-term holding to avoid the impact of short-term fluctuations.

The plunge in the cryptocurrency market has caused panic among investors, and Dogecoin (Doge) has become one of the hardest hit areas. Its price fell sharply, and the total value lock-in of decentralized finance (DeFi) (TVL) also saw a significant decline. The selling wave of "Black Monday" swept the cryptocurrency market, and Dogecoin was the first to be hit. Its DeFiTVL fell to 2023 levels, and the currency price fell 23.78% in the past month. Dogecoin's DeFiTVL fell to a low of $2.72 million, mainly due to a 26.37% decline in the SOSO value index. Other major DeFi platforms, such as the boring Dao and Thorchain, TVL also dropped by 24.04% and 20, respectively.

The recommendations of cryptocurrency trading platforms for different needs are as follows: 1. Newbies are given priority to Coinbase and Binance because of their simple and easy to use interface; 2. High-frequency traders should choose OKX and Gate.io to enjoy low latency and low fees; 3. Institutions and large-value traders recommend Kraken and Gemini because of their compliance and insurance protection; 4. Users who explore small currencies are suitable for KuCoin and Huobi because of their innovation zone and small currencies support.
