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

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

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

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依然可以爬取互联网资料进行一些问答回复。

ChatGPT已经过时了吗,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
'''
Cloning into 'Auto-GPT'...
remote: Enumerating objects: 5702, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 5702 (delta 0), reused 0 (delta 0), pack-reused 5700
Receiving objects: 100% (5702/5702), 1.74 MiB | 10.29 MiB/s, done.
Resolving deltas: 100% (3828/3828), done.
'''

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

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

%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 'AutoGpt.json' 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, 'Entrepreneur-GPT'
AI Name: 
Entrepreneur-GPT here!  I am at your service.
Describe your AI's role:  For example, 'an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.'
Entrepreneur-GPT is: good
Enter up to 5 goals for your AI:  For example: Increase net worth, Grow Twitter Account, Develop and manage multiple businesses autonomously'
Enter nothing to load defaults, enter nothing when finished.
Goal 1: 
Goal 2: 
ChatGPT已经过时了吗,Auto-GPT自主学习生成式模型开源发布

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

Input:1+1=?
SYSTEM:  Human feedback: 1+1=?
 THOUGHTS:  I can use the 'evaluate_code' command to calculate 1+1.
REASONING:  The 'evaluate_code' command can be used to evaluate simple mathematical expressions.
PLAN: 
-  Use the 'evaluate_code' command to calculate 1+1.
CRITICISM:  I should have thought of using the 'evaluate_code' command earlier.
NEXT ACTION:  COMMAND = evaluate_code ARGUMENTS = {'code': '1+1'}
Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' 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 'start_agent' command to start a GPT agent.
CRITICISM:  I should have thought of using a GPT agent earlier.
NEXT ACTION:  COMMAND = start_agent ARGUMENTS = {'name': 'math_agent', 'task': 'Calculate 1+1', 'prompt': 'What is 1+1?'}
Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' 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 'message_agent' command to get the answer to the question.
REASONING:  The 'message_agent' command can be used to get the answer from the GPT agent.

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

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

Input:使用python编写一个冒泡排序算法SYSTEM:  Human feedback: 使用python编写一个冒泡排序算法 THOUGHTS:  I can use the 'evaluate_code' command to evaluate the Python code for a bubble sort algorithm.REASONING:  The 'evaluate_code' command can be used to evaluate Python code.PLAN: -  Use the 'evaluate_code' 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 = {'code': '# Python program for implementation of Bubble Sort\n\narr = [64, 34, 25, 12, 22, 11, 90]\n\n# Traverse through all array elements\nfor i in range(len(arr)):\n\n # Last i elements are already in place\n for j in range(0, len(arr)-i-1):\n\n # traverse the array from 0 to n-i-1\n # Swap if the element found is greater\n # than the next element\n if arr[j] > arr[j+1] :\n arr[j], arr[j+1] = arr[j+1], arr[j]\n\nprint ("Sorted array is:")\nfor i in range(len(arr)):\n print ("%d" %arr[i]),'}Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' 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 'google' command to search for information on bubble sort algorithm in Python.REASONING:  The 'google' command can be used to search for information on the bubble sort algorithm in Python.PLAN: -  Use the 'google' command to search for information on the bubble sort algorithm in Python.CRITICISM:  I should have thought of using the 'google' command earlier.NEXT ACTION:  COMMAND = google ARGUMENTS = {'input': 'bubble sort algorithm in Python'}Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for ...Input:y-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=  SYSTEM:  Command google returned: b'[\n {\n "title": "Python Program for Bubble Sort - GeeksforGeeks",\n "href": "https://www.geeksforgeeks.org/python-program-for-bubble-sort/",  THOUGHTS:  I can use the 'google' command to search for information on bubble sort algorithm in Python. I can also use the 'write_to_file' command to save the code for the bubble sort algorithm in Python to a file.REASONING:  The 'google' command can be used to search for information on the bubble sort algorithm in Python. The 'write_to_file' command can be used to save the code for the bubble sort algorithm in Python to a file.PLAN: -  Use the 'google' command to search for information on the bubble sort algorithm in Python.-  Use the '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

生意营销3大宝:彩铃、定位、认证,一个也不能少,如有需要,添加 微信:xnc528  备注:3

本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 820277912@qq.com 举报,一经查实,本站将立刻删除。
如若转载,请注明出处:https://www.clzz8.com/47890.html