欧美free性护士vide0shd,老熟女,一区二区三区,久久久久夜夜夜精品国产,久久久久久综合网天天,欧美成人护士h版

首頁綜合 正文
目錄

柚子快報邀請碼778899分享:數(shù)據(jù)庫 DB-GPT部署驗證

柚子快報邀請碼778899分享:數(shù)據(jù)庫 DB-GPT部署驗證

http://yzkb.51969.com/

一、DB-GPT簡介

????????DB-GPT是一個開源的數(shù)據(jù)庫領域大模型框架。目的是構建大模型領域的基礎設施,通過開發(fā)多模型管理、Text2SQL效果優(yōu)化、RAG框架以及優(yōu)化、Multi-Agents框架協(xié)作等多種技術能力,讓圍繞數(shù)據(jù)庫構建大模型應用更簡單,更方便。

????????GITHUB源碼地址:GitHub - eosphoros-ai/DB-GPT: Revolutionizing Database Interactions with Private LLM TechnologyRevolutionizing Database Interactions with Private LLM Technology - GitHub - eosphoros-ai/DB-GPT: Revolutionizing Database Interactions with Private LLM Technologyhttps://github.com/eosphoros-ai/DB-GPT.git

1、名詞術語

名詞 說明 DB-GPT DataBase Generative Pre-trained Transformer,一個圍繞數(shù)據(jù)庫與大模型的開源框架 Text2SQL/NL2SQL Text to SQL,利用大語言模型能力,根據(jù)自然語言生成SQL語句,或者根據(jù)SQL語句給出解釋說明 KBQA Knowledge-Based Q&A 基于知識庫的問答系統(tǒng) GBI Generative Business Intelligence 生成式商業(yè)智能,基于大模型與數(shù)據(jù)分析,通過對話方式提供商業(yè)智能分析與決策 LLMOps 大語言模型操作框架,提供標準的端到端工作流程,用于訓練、調(diào)整、部署和監(jiān)控LLM,以加速生成AI模型的應用程序部署 Embedding 將文本、音頻、視頻等資料轉(zhuǎn)換為向量的方法 RAG Retrieval-Augmented Generation 檢索能力增強

2、系統(tǒng)架構

Model Controller:

Model Worker:

Web Server:

API Server:

3、環(huán)境要求

二、源碼部署

1、環(huán)境要求

啟動模式 CPU * MEM GPU 備注 代理模型 4C*8G 代理模型不依賴GPU 本地模型 8C*32G 24G 本地啟動最好有24G以上GPU

2、源碼下載

????????可以在Github上下載最新版本:https://github.com/eosphoros-ai/DB-GPT/releases

wget https://github.com/eosphoros-ai/DB-GPT/archive/refs/tags/v0.4.3.tar.gz

3、Miniconda安裝

????????Miniconda 是一個 Anaconda 的輕量級替代,默認只包含了 python 和 conda,但是可以通過 pip 和 conda 來安裝所需要的包。

????????Miniconda 安裝包可以到清華站下載:Index of /anaconda/miniconda/ | 清華大學開源軟件鏡像站 | Tsinghua Open Source MirrorIndex of /anaconda/miniconda/ | 清華大學開源軟件鏡像站,致力于為國內(nèi)和校內(nèi)用戶提供高質(zhì)量的開源軟件鏡像、Linux 鏡像源服務,幫助用戶更方便地獲取開源軟件。本鏡像站由清華大學 TUNA 協(xié)會負責運行維護。https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/

????????也可以在miniconda官網(wǎng)下載最新安裝包:Miniconda — miniconda documentation

mkdir -p ~/miniconda3

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh

bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3

rm -rf ~/miniconda3/miniconda.sh

~/miniconda3/bin/conda init bash

source ~/.bashrc

?4、配置國內(nèi)conda源

????????各系統(tǒng)都可以通過修改用戶目錄下的?.condarc?文件來使用清華鏡像源? ? ? ??

conda config --set show_channel_urls yes

? ? ? ? 修改~/.condarc的配置文件

channels:

- defaults

show_channel_urls: true

default_channels:

- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r

- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2

custom_channels:

conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

deepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/

? ? ? ? ?清華源幫助文檔地址:anaconda | 鏡像站使用幫助 | 清華大學開源軟件鏡像站 | Tsinghua Open Source Mirroranaconda 使用幫助 | 鏡像站使用幫助 | 清華大學開源軟件鏡像站,致力于為國內(nèi)和校內(nèi)用戶提供高質(zhì)量的開源軟件鏡像、Linux 鏡像源服務,幫助用戶更方便地獲取開源軟件。本鏡像站由清華大學 TUNA 協(xié)會負責運行維護。https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/????????也可以選擇其他國內(nèi)源

# 中科大鏡像源

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/

?

# 阿里鏡像源

conda config --add channels https://mirrors.aliyun.com/pypi/simple/

?

# 豆瓣的python的源

conda config --add channels http://pypi.douban.com/simple/?

?

# 顯示檢索路徑,每次安裝包時會將包源路徑顯示出來

conda config --set show_channel_urls yes

conda config --set always_yes True

conda config --set auto_activate_base False

?

#執(zhí)行以下命令清除索引緩存,保證用的是鏡像站提供的索引

conda clean -i

?

# 顯示所有鏡像通道路徑命令

conda config --show channels

5、創(chuàng)建Python環(huán)境

????????因為編譯源碼需要python >= 3.10,所以使用conda創(chuàng)建python環(huán)境

conda create -n dbgpt_env python=3.10

conda activate dbgpt_env

6、配置國內(nèi)pip源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

? ? ? ? 或修改pip配置文件,如 vi /root/.config/pip/pip.conf

[global]

index-url = https://pypi.tuna.tsinghua.edu.cn/simple

? ? ? ? 其他國內(nèi)源:

? ? ? ? 阿里云:https://mirrors.aliyun.com/pypi/simple/

7、編譯源碼

tar -zxf v0.4.3.tar.gz

cd DB-GPT-0.4.3

pip install -e ".[default]"

? ? ? ? ?編譯時間較長,知道提示編譯成功

三、模型部署

? ? ? ? 直接是用git下載huggingface.co開源網(wǎng)站的模型文件會使用到git-lfs,需要提前安裝。

apt-get install git-lfs

? ? ? ? 在DB-GPT目錄下創(chuàng)建models目錄,用于存放下載的本地模型文件

cd DB-GPT-0.4.3

mkdir models

1、下載embedding model

1.1 text2vec-large-chinese

git clone https://huggingface.co/GanymedeNil/text2vec-large-chinese

1.2 m3e-large

git clone https://huggingface.co/moka-ai/m3e-large

2、下載llm model

2.1 Vicuna

2.1.1?硬件需求說明

ModelQuantizeVRAM SizeVicuna-7b-1.54-bit8GBVicuna-7b-1.58-bit12GBvicuna-13b-v1.54-bit12GBvicuna-13b-v1.58-bit24GB

2.1.2 下載地址

git clone https://huggingface.co/lmsys/vicuna-13b-v1.5

2.1.3 環(huán)境變量配置

????????在 .env 文件中配置LLM_MODEL參數(shù)

LLM_MODEL=vicuna-13b-v1.5

2.2 ChatGLM2

?2.1.1?硬件需求說明

ModelQuantizeVRAM SizeChatGLM-6b4-bit7GBChatGLM-6b8-bit9GBChatGLM-6bFP1614GB

2.1.2 下載地址

git clone https://huggingface.co/THUDM/chatglm2-6b

2.1.3 環(huán)境變量配置

????????在 .env 文件中配置LLM_MODEL參數(shù)

LLM_MODEL=chatglm2-6b

2.3 llama.cpp(CPU運行)

2.3.1 直接下載

????????下載已經(jīng)轉(zhuǎn)換好的文件TheBloke/vicuna-13B-v1.5-GGUF,將模型重命名為: ggml-model-q4_0.gguf,存放在models目錄

git clone https://huggingface.co/TheBloke/vicuna-13B-v1.5-GGUF

?2.3.2 手工轉(zhuǎn)換

? ? ? ? 自行轉(zhuǎn)換模型文件,將模型重命名為: ggml-model-q4_0.gguf,存放在models目錄

# obtain the original LLaMA model weights and place them in ./models

ls ./models

65B 30B 13B 7B tokenizer_checklist.chk tokenizer.model

# [Optional] for models using BPE tokenizers

ls ./models

65B 30B 13B 7B vocab.json

# install Python dependencies

python3 -m pip install -r requirements.txt

# convert the 7B model to ggml FP16 format

python3 convert.py models/7B/

# [Optional] for models using BPE tokenizers

python convert.py models/7B/ --vocabtype bpe

# quantize the model to 4-bits (using q4_0 method)

./quantize ./models/7B/ggml-model-f16.gguf ./models/7B/ggml-model-q4_0.gguf q4_0

# update the gguf filetype to current if older version is unsupported by another application

./quantize ./models/7B/ggml-model-q4_0.gguf ./models/7B/ggml-model-q4_0-v2.gguf COPY

# run the inference

./main -m ./models/7B/ggml-model-q4_0.gguf -n 128

2.3.3 安裝依賴

????????llama.cpp在DB-GPT中是可選安裝項, 你可以通過以下命令進行安裝

pip install -e ".[llama_cpp]"

2.3.4 環(huán)境變量修改

????????修改.env文件使用llama.cpp

LLM_MODEL=llama-cpp

llama_cpp_prompt_template=vicuna_v1.1

四、數(shù)據(jù)庫部署

1、安裝Mysql

# 更新apt源

apt update

#下載mysql-server

apt install mysql-server

#查看mysql的狀態(tài),開啟mysql

service mysql status

service mysql start

#進入mysql終端

mysql

#設置root密碼,注意這里的密碼應該和DB-GPT中的.env文件保持一致

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Mysql2023';

#登錄mysql,這里會提示輸入密碼,可以查看自己密碼創(chuàng)建是否正確

mysql -u root -p

2、數(shù)據(jù)庫配置

? ? ? ? 修改.env文件中數(shù)據(jù)庫的配置

#*******************************************************************#

#** ? ? ? ? ? ? ? ? ?DB-GPT METADATA DATABASE SETTINGS ? ? ? ? ? ?**#

#*******************************************************************#

### SQLite database (Current default database)

#LOCAL_DB_TYPE=sqlite

### MYSQL database

LOCAL_DB_TYPE=mysql

LOCAL_DB_USER=root

LOCAL_DB_PASSWORD={your_password}

LOCAL_DB_HOST=127.0.0.1

LOCAL_DB_PORT=3306

LOCAL_DB_NAME=dbgpt

3、測試數(shù)據(jù)

bash ./scripts/examples/load_examples.sh

五、運行服務

1、整體啟動

? ? ? ? 通過命令一鍵啟動整個DB-GPT服務

python dbgpt/app/dbgpt_server.py

2、分服務啟動

2.1 啟動Model Controller

? ? ? ? Model Server默認端口為8000

dbgpt start controller

? ? ? ? 啟動成功如下:?

2.2?啟動Model Worker

2.2.1?啟動chatglm2-6b模型Worker

dbgpt start worker --model_name chatglm2-6b \

--model_path /DB-GPT-0.4.3/models/chatglm2-6b \

--port 8001 \

--controller_addr http://127.0.0.1:8000

? 如果報錯?'ChatGLMTokenizer' object has no attribute 'tokenizer',則需要降級transformers,存在問題的版本為4.36.0,改為4.33.3

pip uninstall transformers

pip install transformers==4.33.3

2.2.2?啟動vicuna-13b-v1.5模型Worker

dbgpt start worker --model_name vicuna-13b-v1.5 \

--model_path /DB-GPT-0.4.3/models/vicuna-13b-v1.5 \

--port 8002 \

--controller_addr http://127.0.0.1:8000

2.3 啟動Embedding模型服務

dbgpt start worker --model_name text2vec \

--model_path /DB-GPT-0.4.3/models/text2vec-large-chinese \

--worker_type text2vec \

--port 8003 \

--controller_addr http://127.0.0.1:8000

2.4 查看并檢查已部署模型

dbgpt model list

????????顯示當前運行的模型信息如下

2.5?啟動Web Server服務

????????--light 表示不啟動嵌入式模型服務,嵌入式模型服務默認為

dbgpt start webserver --light

2.6?瀏覽頁面

? ? ? ? 使用瀏覽器訪問頁面http://localhost:5000/

2.7?查看顯存使用

nvidia-smi

? ? ? ? 顯示顯卡使用信息如下:

?????????

柚子快報邀請碼778899分享:數(shù)據(jù)庫 DB-GPT部署驗證

http://yzkb.51969.com/

相關閱讀

評論可見,查看隱藏內(nèi)容

本文內(nèi)容根據(jù)網(wǎng)絡資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點和立場。

轉(zhuǎn)載請注明,如有侵權,聯(lián)系刪除。

本文鏈接:http://gantiao.com.cn/post/18959872.html

發(fā)布評論

您暫未設置收款碼

請在主題配置——文章設置里上傳

掃描二維碼手機訪問

文章目錄