窝牛号

ChatGPT已经过时了吗,Auto-GPT自主学习生成式模型开源发布

ChatGPT已经火了几个月了,基于ChatGPT的应用也随之应运而生,但是ChatGPT需要人为的输入prompt指令来控制ChatGPT模型的输出,不同的prompt以及prompt的质量差别都会导致ChatGPT的回复不一致,回答的内容也差不比较大。这不Auto-GPT就是基于以上的痛点,设计了一个可以自己学习,自己改善内容的GPT。短短几个周的时间,其GitHub星星已经超过76.8K,超过了pytorch的gitHub星星数量。

Auto-GPT

Auto-GPT是一个基于GPT-4,开源的可以自己学习的语言大模型,当然若想使用Auto-GPT,我们需要有Chat-GPT的API key,且模型基于GPT-4,若想体验比较强大的GPT功能,我们需要使用付费账号进行体验。既然Auto-GPT是一个可以自主学习的模型,是否我们没有Chat-GPT的API key,它是否可以使用互联网上的资源进行问答呢?答案是肯定的,虽然没有Chat-GPT的加持,Auto-GPT依然可以爬取互联网资料进行一些问答回复。

Auto-GPT需要使用付费账号

Auto-GPT代码实现

既然是开源的代码,我们就分享下如何来使用Auto-GPT,首先Auto-GPT基于ChatGPT开发,我们需要有一个API key,当然也不是必须的。然后python代码版本大于3.8.0。

https://github.com/Significant-Gravitas/Auto-GPT 项目地址

本代码运行在Google colab上,若运行在本地,请把命令行的叹号去掉。

!git clone https://github.com/Significant-Gravitas/Auto-GPT.git &39;&39;Auto-GPT&39;&39;

首先我们需要把Auto-GPT clone到Google colab本地,当然若运行到本地,也可以使用git命令clone到自己的电脑上面。若没有git命令,也可以直接到Auto-GPT的GitHub仓库,点击code>> download zip,下载整个项目工程到本地即可。

%cd Auto-GPT !pip install -r requirements.txt

然后,我们进入Auto-GPT文件夹下,使用pip命令安装需要的第三方库,等待安装完成后,就可以运行Auto-GPT了,本地也是同样的过程,在Auto-GPT文件夹下,CMD命令行,然后输入pip install -r requirements.txt来安装所有的库。

!Python -m autogpt

最后我们直接使用python -m autogpt来运行Auto-GPT。通过以上的步骤,我们就可以成功的搭建了自己的Auto-GPT,代码运行后,要求我们需要输入Auto-GPT的名字,角色,已经要完成的目标,若不输入,模型采用默认的名字角色等。设置完成后,就可以跟我们的Auto-GPT进行聊天了。

Warning: The file &39; does not exist.Local memory would not be saved to a file. Welcome to Auto-GPT! Enter the name of your AI and its role below. Entering nothing will load defaults. Name your AI: For example, &39; AI Name: Entrepreneur-GPT here! I am at your service. Describe your AI&39;an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.&39; Enter nothing to load defaults, enter nothing when finished. Goal 1: Goal 2:

首先,这里输入了一个最简单的命令1+1=多少的问题,由于小编这里输入的是GPT-3的API-key,因此程序提示没有gpt-4模型,但是程序使用了GPT agent来响应了这个简单的计算。

Input:1+1=? SYSTEM: Human feedback: 1+1=? THOUGHTS: I can use the &39; command to calculate 1+1. REASONING: The &39; command can be used to evaluate simple mathematical expressions. PLAN: - Use the &39; command to calculate 1+1. CRITICISM: I should have thought of using the &39; command earlier. NEXT ACTION: COMMAND = evaluate_code ARGUMENTS = {&39;: &39;} Enter &39; to authorise command, &39; to run N continuous commands, &39; to exit program, or enter feedback for ... Input:y -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= SYSTEM: Command evaluate_code returned: Error: The model: `gpt-4` does not exist THOUGHTS: I need to start a GPT agent to help me with this task. REASONING: Starting a GPT agent can help me with this task. PLAN: - Use the &39; command to start a GPT agent. CRITICISM: I should have thought of using a GPT agent earlier. NEXT ACTION: COMMAND = start_agent ARGUMENTS = {&39;: &39;, &39;: &39;, &39;: &39;} Enter &39; to authorise command, &39; to run N continuous commands, &39; to exit program, or enter feedback for ... Input:y -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= SYSTEM: Command start_agent returned: Agent math_agent created with key 0. First response: The sum of 1+1 is 2. THOUGHTS: I can use the &39; command to get the answer to the question. REASONING: The &39; command can be used to get the answer from the GPT agent.

然后,我们再来一个稍微复杂的例子,让auto-GPT来写一个冒泡排序算法。这里使用了中文输入,但是模型能够识别,且重新翻译成了英文,然后,模型也给出了冒泡排序的算法代码,唯一不足的是模型输出的是文本,代码的缩进都没有了,而且模型搜索了Google,还提供了介绍排序算法的URL地址,真是强大了。感兴趣的小伙伴可以阅读一下下面的模型回复。

Input:使用python编写一个冒泡排序算法 SYSTEM: Human feedback: 使用python编写一个冒泡排序算法 THOUGHTS: I can use the &39; command to evaluate the Python code for a bubble sort algorithm. REASONING: The &39; command can be used to evaluate Python code. PLAN: - Use the &39; command to evaluate the Python code for a bubble sort algorithm. CRITICISM: I should have asked for more information about the bubble sort algorithm before attempting to evaluate the code. NEXT ACTION: COMMAND = evaluate_code ARGUMENTS = {&39;: & Python program for implementation of Bubble Sortnnarr = [64, 34, 25, 12, 22, 11, 90]nn Last i elements are already in placen for j in range(0, len(arr)-i-1):nn Swap if the element found is greatern 34;Sorted array is:&34;%d&39;} Enter &39; to authorise command, &39; to run N continuous commands, &39; to exit program, or enter feedback for ... Input:y -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= SYSTEM: Command evaluate_code returned: Error: The model: `gpt-4` does not exist THOUGHTS: I can use the &39; command to search for information on bubble sort algorithm in Python. REASONING: The &39; command can be used to search for information on the bubble sort algorithm in Python. PLAN: - Use the &39; command to search for information on the bubble sort algorithm in Python. CRITICISM: I should have thought of using the &39; command earlier. NEXT ACTION: COMMAND = google ARGUMENTS = {&39;: &39;} Enter &39; to authorise command, &39; to run N continuous commands, &39; to exit program, or enter feedback for ... Input:y -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= SYSTEM: Command google returned: b&34;title&34;Python Program for Bubble Sort - GeeksforGeeks&34;href&34;https://www.geeksforgeeks.org/python-program-for-bubble-sort/&39;google&39;write_to_file&39;google&39;write_to_file&39;google&39;write_to_file' command to save the code for the bubble sort algorithm in Python to a file.

一些错误信息以及相关的log,可以使用如下命令行来查看

python -m autogpt --debug

当然,我们也可以使用语音输入

python -m autogpt --speak

本站所发布的文字与图片素材为非商业目的改编或整理,版权归原作者所有,如侵权或涉及违法,请联系我们删除

窝牛号 wwww.93ysy.com   沪ICP备2021036305号-1