準(zhǔn)備工作
-
下載源碼
text-generation-Webui -
下載模型
chinese-alpaca-2-7b-hf下載完成的模型需要放置在項(xiàng)目下的models目錄下 -
安裝conda
Free Download | Anaconda -
安裝python
? python -
設(shè)置環(huán)境變量
-
下載最新的顯卡驅(qū)動
英偉達(dá)2060顯卡驅(qū)動需要與自己顯卡匹配
- 查看顯卡驅(qū)動版本
部署工作
- 創(chuàng)建conda環(huán)境
conda create -n textgen python=3.10.9
- 初始化
conda init
- 激活
conda activate textgen
- 安裝pytorch注意此處安裝的版本需要與顯卡對應(yīng)否則會報(bào)各種錯(cuò)誤
pip install torch torchvision torchaudio -f https://download.pytorch.org/whl/cu121/torch_stable.html
cu121表示對應(yīng)顯卡版本12,可以從官網(wǎng)查看,這個(gè)很關(guān)鍵
- 安裝項(xiàng)目的依賴
pip install -r requirements.txt
- 加載模型并啟動
python server.py --model chinese-alpaca-2-7b --chat
- 加載成功后顯示
- 打開瀏覽器輸入對應(yīng)的地址
9. 設(shè)置模型參數(shù)
踩坑記錄
-
‘conda’ 不是內(nèi)部或外部命令,也不是可運(yùn)行的程序 或批處理文件。
沒有安裝conda導(dǎo)致,且需要配置環(huán)境變量
-
版本太高
Channels: - defaults Platform: win-64 Collecting package metadata (repodata.json): done Solving environment: failed PackagesNotFoundError: The following packages are not available from current channels: - python=3.12.1* Current channels: - defaults To search for alternate channels that may provide the conda package you're looking for, navigate to https://anaconda.org and use the search bar at the top of the page.
這個(gè)錯(cuò)誤是因?yàn)樵诋?dāng)前Conda默認(rèn)的渠道(
defaults)中找不到名為
python且版本為
3.12.1的包。這可能是因?yàn)?.12.1版本的Python還沒有被添加到默認(rèn)的Conda渠道中。
-
conda需要先初始化
User
F:\AI\text-generation-webui-main>conda activate textgen
CondaError: Run 'conda init' before 'conda activate'
F:\AI\text-generation-webui-main>conda activate textgen
CondaError: Run 'conda init' before 'conda activate'
執(zhí)行 conda init命令
- 執(zhí)行 conda init 命令后無法激活
User
F:\AI\text-generation-webui-main>conda init
no change D:\ProgramData\miniconda3\Scripts\conda.exe
no change D:\ProgramData\miniconda3\Scripts\conda-env.exe
no change D:\ProgramData\miniconda3\Scripts\conda-script.py
no change D:\ProgramData\miniconda3\Scripts\conda-env-script.py
no change D:\ProgramData\miniconda3\condabin\conda.bat
no change D:\ProgramData\miniconda3\Library\bin\conda.bat
no change D:\ProgramData\miniconda3\condabin\_conda_activate.bat
no change D:\ProgramData\miniconda3\condabin\rename_tmp.bat
no change D:\ProgramData\miniconda3\condabin\conda_auto_activate.bat
no change D:\ProgramData\miniconda3\condabin\conda_hook.bat
no change D:\ProgramData\miniconda3\Scripts\activate.bat
no change D:\ProgramData\miniconda3\condabin\activate.bat
no change D:\ProgramData\miniconda3\condabin\deactivate.bat
modified D:\ProgramData\miniconda3\Scripts\activate
modified D:\ProgramData\miniconda3\Scripts\deactivate
modified D:\ProgramData\miniconda3\etc\profile.d\conda.sh
modified D:\ProgramData\miniconda3\etc\fish\conf.d\conda.fish
no change D:\ProgramData\miniconda3\shell\condabin\Conda.psm1
modified D:\ProgramData\miniconda3\shell\condabin\conda-hook.ps1
no change D:\ProgramData\miniconda3\Lib\site-packages\xontrib\conda.xsh
modified D:\ProgramData\miniconda3\etc\profile.d\conda.csh
modified C:\Users\li132\Documents\WindowsPowerShell\profile.ps1
modified HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
==> For changes to take effect, close and re-open your current shell. <==
F:\AI\text-generation-webui-main>conda activate textgen
CondaError: Run 'conda init' before 'conda activate'
F:\AI\text-generation-webui-main>
請按照指示關(guān)閉當(dāng)前的命令提示符或PowerShell窗口。然后重新打開一個(gè)新窗口,并嘗試再次激活你的Conda環(huán)境:
- 目錄名稱無效
Building wheels for collected packages: hqq, rouge-score, ffmpy, sqlitedict
ERROR: Error [WinError 267] 目錄名稱無效。 while executing command python setup.py bdist_wheel
Building wheel for hqq (setup.py) ... error
ERROR: Failed building wheel for hqq
Running setup.py clean for hqq
ERROR: Error [WinError 267] 目錄名稱無效。 while executing command python setup.py clean
ERROR: Failed cleaning build dir for hqq
ERROR: Error [WinError 267] 目錄名稱無效。 while executing command python setup.py bdist_wheel
Building wheel for rouge-score (setup.py) ... error
ERROR: Failed building wheel for rouge-score
Running setup.py clean for rouge-score
ERROR: Error [WinError 267] 目錄名稱無效。 while executing command python setup.py clean
ERROR: Failed cleaning build dir for rouge-score
Building wheel for ffmpy (setup.py) ... done
Created wheel for ffmpy: filename=UNKNOWN-0.0.0-py3-none-any.whl size=929 sha256=c39123b3685649e5c5b9257c5604bff8e38ba7fd93f903cde779483dde2b9e3c
Stored in directory: c:\users\li132\appdata\local\pip\cache\wheels\01\a6\d1\1c0828c304a4283b2c1639a09ad86f83d7c487ef34c6b4a1bf
WARNING: Built wheel for ffmpy is invalid: Wheel has unexpected file name: expected 'ffmpy', got 'UNKNOWN'
ERROR: Error [WinError 267] 目錄名稱無效。 while executing command python setup.py bdist_wheel
Building wheel for sqlitedict (setup.py) ... error
ERROR: Failed building wheel for sqlitedict
Running setup.py clean for sqlitedict
ERROR: Error [WinError 267] 目錄名稱無效。 while executing command python setup.py clean
ERROR: Failed cleaning build dir for sqlitedict
Failed to build hqq rouge-score ffmpy sqlitedict
ERROR: Could not build wheels for hqq, rouge-score, ffmpy, sqlitedict, which is required to install pyproject.toml-based projects
不要用cmd ,用Powershell
- 加載模型名稱錯(cuò)誤
拼寫正確即可
- 安裝了錯(cuò)誤的torch,不支持gpu計(jì)算
運(yùn)行 python -c "impot torch;print(torch.cuda.is_available()) 判斷返回值,false表示不支持,true表示支持,卸載重裝"
- 前方高能,這里有個(gè)大坑
之前看其他博主安裝時(shí)通過start_windows.bat 安裝,網(wǎng)頁啟動后加載模型然后報(bào) ExLlama這個(gè)模塊找不到的錯(cuò)誤,于是乎看到國內(nèi)的Gitee上的項(xiàng)目說exllama需要安裝微軟的編譯器環(huán)境及英偉達(dá)的CUDA驅(qū)動(這個(gè)驅(qū)動安裝包3G),按照操作走流程。最終還是找不到這個(gè)模塊,于是放棄了,采用conda的方式進(jìn)行安裝,安裝的時(shí)候CUDA驅(qū)動一直沒有刪除,直到看到這里
通過mvcc -version 命令查看顯卡CUDA驅(qū)動版本11.8,下載了對應(yīng)的torch版本對應(yīng)的為11.8
該版本的torch顯示支持顯卡驅(qū)動了,啟動報(bào)錯(cuò)顯示找不到模塊。
說明11.8的torch與CUDA 11.8 不匹配。卸載了11.8的torch和刪除了CUDA驅(qū)動,后重寫安裝。torch用官網(wǎng)的12.1 ,驅(qū)動下載最新的12(600MB)再次啟動才成功。
- 卸載
- 安裝12.1torch
文章來源:http://www.zghlxwxcb.cn/news/detail-787819.html
- 此時(shí)CUDA驅(qū)動(3GB)還沒有卸載,安裝了最新的torch啟動報(bào)錯(cuò)提示版本低
文章來源地址http://www.zghlxwxcb.cn/news/detail-787819.html
- 從官網(wǎng)下載通用版的驅(qū)動(600MB)后再次執(zhí)行,啟動成功!
參考文獻(xiàn):(https://bbs.huaweicloud.com/blogs/412544)
到了這里,關(guān)于text-generation-Webui-AI本地部署踩坑記錄的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!