Webman AI發(fā)布3.6版,支持訓(xùn)練。
已經(jīng)購(gòu)買(mǎi)Webman AI的同學(xué)在webman-admin管理后臺(tái)一鍵升級(jí)。
需要購(gòu)買(mǎi)Webman AI的同學(xué)在點(diǎn)此購(gòu)買(mǎi)
基礎(chǔ)版購(gòu)買(mǎi)地址
plus版購(gòu)買(mǎi)地址
測(cè)試地址: http://wtbis.cn/ai#role=40
只訓(xùn)練了webman手冊(cè),所以只能提問(wèn)webman手冊(cè)的內(nèi)容
webmnan AI QQ交流群 789898358
歡迎加入
假設(shè)你已經(jīng)安裝了webnman/ai,沒(méi)安裝的參考webman.ai購(gòu)買(mǎi)頁(yè)面安裝部分
以下是webman/ai訓(xùn)練模塊依賴的服務(wù)及組件安裝步驟。
docker pull redis/redis-stack
mkdir /home/data/redis -p
docker run --name redis-stack -v /home/data/redis:/data -p 6380:6379 -d redis/redis-stack
webman根目錄執(zhí)行
composer require -W illuminate/redis illuminate/events
新建 plugin/ai/config/redis.php
,內(nèi)容如下
<?php
return [
'default' => [
'host' => '127.0.0.1',
'password' => null,
'port' => 6380,
'database' => 0,
],
];
Linux: webman根目錄運(yùn)行 php start.php restart -d
Windows: 按ctl c
停止webman,然后運(yùn)行 php windows.php start
提示
如果提示 Class'Redis' not found 是因?yàn)闆](méi)有給PHP安裝Redis擴(kuò)展。
訓(xùn)練的文本樣例
注意:訓(xùn)練內(nèi)容沒(méi)有固定格式,訓(xùn)練的數(shù)據(jù)最好頂部加上一個(gè)對(duì)本內(nèi)容的總結(jié)性標(biāo)題或提問(wèn),這樣效果才會(huì)最好。類(lèi)似上面這個(gè)截圖
完整的webman手冊(cè)樣本數(shù)據(jù),點(diǎn)擊這里下載
提示
導(dǎo)入數(shù)據(jù)目前只支持txt和md為后綴的文件,單個(gè)文件大小不能大于9k。支持壓縮包上傳,同理壓縮包內(nèi)每個(gè)文件大小不能大于9k。
AI訓(xùn)練數(shù)據(jù) 里的 內(nèi)容向量 里有值,說(shuō)明此條記錄已經(jīng)訓(xùn)練完畢,內(nèi)容向量 同時(shí)會(huì)在redis-stack里存儲(chǔ)一份,用來(lái)快速檢索。
注意
如果你不想讓你訓(xùn)練的模型回復(fù)訓(xùn)練內(nèi)容以外的數(shù)據(jù),可以在角色提示詞里明示。例如webman手冊(cè)助手的角色提示詞如下:
“webman是一個(gè)高性能php框架,你是一個(gè)webman助手,以下是webman文檔,請(qǐng)根據(jù)文檔回復(fù),如果無(wú)法得到答案或者不是webman相關(guān)的問(wèn)題則回復(fù)文檔中未找到對(duì)應(yīng)的答案。請(qǐng)確保回復(fù)正確?!?/p>
在需要使用訓(xùn)練數(shù)據(jù)的角色里選擇訓(xùn)練集,保存。(前端用戶需要刷新頁(yè)面角色才能生效)
AI就會(huì)使用訓(xùn)練集里的數(shù)據(jù)回復(fù)問(wèn)題。
訓(xùn)練數(shù)據(jù)的時(shí)候,報(bào)錯(cuò),希望能調(diào)整一下訓(xùn)練的速度:
{ "error": { "message": "Rate limit reached for text-embedding-ada-002 in organization org-ug1Mtx1ioIEqKPgDkqWhpLn0 on requests per min (RPM): Limit 3, Used 3, Requested 1. Please try again in 20s. Visit https://platform.openai.com/account/rate-limits to learn more. You can increase your rate limit by adding a payment method to your account at https://platform.openai.com/account/billing.", "type": "requests", "param": null, "code": "rate_limit_exceeded" } }
5刀的key有每分鐘3次的頻率限制,如果你只有一個(gè)5刀的key,這里設(shè)置為20,2個(gè)就設(shè)置為10,以此類(lèi)推。
亂碼問(wèn)題 修改plugin/ai/config/app.php 中的version,改為6.3.0,reload后在管理后臺(tái)重新升級(jí)下ai。
調(diào)用 DALL.E作圖 一直報(bào)下面的錯(cuò)誤
Rate limit exceeded for images per minute in organization org-C6WYHWzWeqmaJNl2ouZlEYwX. Limit: 0/1min. Current: 1/1min. Please visit https://platform.openai.com/docs/guides/rate-limits to learn how to increase your rate limit.
我只給文心一言設(shè)置了apiKey的配置,問(wèn)答可以,訓(xùn)練不行!
{ "error": { "message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.", "type": "invalid_request_error", "param": null, "code": null } }
我一定要設(shè)置openai才能向量訓(xùn)練嘛?
老大,請(qǐng)教下,為什么點(diǎn)擊訓(xùn)練彈窗提示Connection refused
放假前都能訓(xùn)練數(shù)據(jù)的,現(xiàn)在導(dǎo)入數(shù)據(jù)后就提示Connection refused這個(gè)
AI能正常問(wèn)答的
這是返回的報(bào)錯(cuò)內(nèi)容
RedisException: Connection refused in /home/wwwroot//web/vendor/illuminate/redis/Connectors/PhpRedisConnector.php:161\nStack trace:\n#0
/home/wwwroot//web/vendor/illuminate/redis/Connectors/PhpRedisConnector.php(161): Redis->connect('127.0.0.1', 6380, 0, NULL, 0, 0)\n#1
/home/wwwroot//web/vendor/illuminate/redis/Connectors/PhpRedisConnector.php(90): Illuminate\Redis\Connectors\PhpRedisConnector->establishConn…ot//web/vendor/workerman/workerman/Worker.php(1721): Workerman\Worker::monitorWorkersForLinux()\n#25
/home/wwwroot//web/vendor/workerman/workerman/Worker.php(562): Workerman\Worker::monitorWorkers()\n#26
/home/wwwroot//web/vendor/workerman/webman-framework/src/support/App.php(131): Workerman\Worker::runAll()\n#27
/home/wwwroot/***/web/start.php(4): support\App::run()\n#28 {main}"
重啟容器就好了!謝謝
docker run redis-stack直接這個(gè)報(bào)錯(cuò),查看容器ID后,docker start 容器ID 后成功了!
訓(xùn)練不同模型效果不太一樣……
“如果你不想讓你訓(xùn)練的模型回復(fù)訓(xùn)練內(nèi)容以外的數(shù)據(jù)”,這塊是不是只有chatgpt有用,智普好像不行……
訓(xùn)練的邏輯:
1、 將后臺(tái)上傳的文檔 通過(guò)openai api 轉(zhuǎn)換成向量 存到mysql 并把向量值存在redis
2、 前臺(tái)用戶對(duì)話 。 將用戶輸入內(nèi)容 通用通過(guò)openai 的api接口 轉(zhuǎn)換成向量。 然后 根據(jù)向量去redis 搜索類(lèi)似向量
3、 然后去mysql 獲取對(duì)應(yīng)的文本信息
4、 然后將mysql 獲取的文本信息 追加到 prompt 調(diào)用openai 的complete api 。
因?yàn)?role 設(shè)置的prompt是:
webman是一個(gè)高性能php框架,你是一個(gè)webman助手,以下是webman文檔,請(qǐng)根據(jù)文檔回復(fù),如果無(wú)法得到答案或者不是webman相關(guān)的問(wèn)題則回復(fù)文檔中未找到對(duì)應(yīng)的答案。請(qǐng)確?;貜?fù)正確。
complete api 會(huì)將從redis 搜索到的文本內(nèi)容 追加在這后面。 這就造成咯文檔以外的內(nèi)容不回復(fù)的效果;