中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

北京平臺網(wǎng)站建設(shè)哪家好開封網(wǎng)站推廣公司

北京平臺網(wǎng)站建設(shè)哪家好,開封網(wǎng)站推廣公司,萊蕪專業(yè)做網(wǎng)站的,學做網(wǎng)站看什么書codeshell安裝配置 1 注意事項1.1 Python版本問題 2 codeshell環(huán)境搭建2.1 codeshell使用軟件各版本2.2 軟件下載2.3 codeshell使用環(huán)境安裝2.3.1 python-3.10.9-amd64.exe安裝2.3.2 Anaconda3-2022.10-Windows-x86_64.exe安裝2.3.3 創(chuàng)建環(huán)境2.3.4 Pytorch安裝2.3.5 transforme…

codeshell安裝配置

  • 1 注意事項
    • 1.1 Python版本問題
  • 2 codeshell環(huán)境搭建
    • 2.1 codeshell使用軟件各版本
    • 2.2 軟件下載
    • 2.3 codeshell使用環(huán)境安裝
      • 2.3.1 python-3.10.9-amd64.exe安裝
      • 2.3.2 Anaconda3-2022.10-Windows-x86_64.exe安裝
      • 2.3.3 創(chuàng)建環(huán)境
      • 2.3.4 Pytorch安裝
      • 2.3.5 transformers
  • 3 下載codeshell模型
  • 4 codeshell使用
    • 注意:這里是在py310環(huán)境使用的,所以需要先激活py310環(huán)境。
    • 4.1 Web UI
    • 4.2 CLI Demo
  • 5 總結(jié)

1 注意事項

1.1 Python版本問題

codeshell推薦使用的python版本是3.8以上,但是最好不要選擇最新版本的,否則可能會在配置pytorch環(huán)境時,報環(huán)境不兼容的錯誤。

這里使用目前最新版本python=3.12后,錯誤信息如下:

(py312) C:\Users\lc>conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: |
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failedUnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:Specifications:- torchaudio -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0']- torchaudio -> python[version='>=3.10,<3.11.0a0|>=3.11,<3.12.0a0|>=3.9,<3.10.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0']- torchvision -> python[version='>=3.10,<3.11.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0|>=3.11,<3.12.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0']Your python: python=3.12If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.The following specifications were found to be incompatible with each other:Output in format: Requested package -> Available versionsPackage pytorch-cuda conflicts for:
torchvision -> pytorch==2.1.0 -> pytorch-cuda[version='>=11.6,<11.7|>=11.7,<11.8|>=11.8,<11.9|>=12.1,<12.2']
torchaudio -> pytorch==2.1.0 -> pytorch-cuda[version='>=11.6,<11.7|>=11.7,<11.8|>=11.8,<11.9|>=12.1,<12.2']
torchaudio -> pytorch-cuda[version='11.6.*|11.7.*|11.8.*|12.1.*']
torchvision -> pytorch-cuda[version='11.6.*|11.7.*|11.8.*|12.1.*']Package setuptools conflicts for:
python=3.12 -> pip -> setuptools
pytorch -> jinja2 -> setuptools
torchvision -> setuptoolsPackage flit-core conflicts for:
torchvision -> typing_extensions -> flit-core[version='>=3.6,<4']
pytorch -> typing_extensions -> flit-core[version='>=3.6,<4']Package pytorch conflicts for:
torchvision -> pytorch[version='1.10.0|1.10.1|1.10.2|1.11.0|1.12.0|1.12.1|1.13.0|1.13.1|2.0.0|2.0.1|2.1.0|1.9.1|1.9.0|1.8.1|1.8.0|1.7.1|1.7.0|1.6.0|1.5.1']
torchaudio -> pytorch[version='1.10.0|1.10.1|1.10.2|1.11.0|1.12.0|1.12.1|1.13.0|1.13.1|2.0.0|2.0.1|2.1.0|1.9.1|1.9.0|1.8.1|1.8.0|1.7.1|1.7.0|1.6.0']Package requests conflicts for:
torchvision -> requests
python=3.12 -> pip -> requests

2 codeshell環(huán)境搭建

codeshell地址:https://github.com/WisdomShell/codeshell

codeshell使用環(huán)境:

  1. python 3.8 and above【python 3.8以上】
  2. pytorch 2.0 and above are recommended【pytorch 建議2.0以上】
  3. transformers 4.32 and above【transformers 4.32以上】
  4. CUDA 11.8 and above are recommended (this is for GPU users, flash-attention users, etc.)【CUDA 11.8以上(可選)】

2.1 codeshell使用軟件各版本

  1. python-3.10.9-amd64.exe【這里選擇的是2022年的版本】
  2. Anaconda3-2022.10-Windows-x86_64.exe【用于安裝管理Pytorch,這里選擇的是2022年最后一個版本】
  3. Pytorch【根據(jù)實際情況而定】
  4. transformers【默認最新版】

2.2 軟件下載

  1. python-3.10.9-amd64.exe
    • 下載地址:https://www.python.org/downloads
    • 選擇如圖所示下載

在這里插入圖片描述
2. Anaconda3-2022.10-Windows-x86_64.exe
- 下載地址:清華開源鏡像anaconda
- 選擇如圖所示下載在這里插入圖片描述
3. Pytorch【非安裝包的形式,不用下載】
4. transformers【非安裝包的形式,不用下載】

2.3 codeshell使用環(huán)境安裝

2.3.1 python-3.10.9-amd64.exe安裝

  1. 選擇自定義安裝,并勾選使用管理員權(quán)限安裝和將python.exe加入到環(huán)境。
    在這里插入圖片描述
  2. 設(shè)置自定義安裝位置
    在這里插入圖片描述
  3. 驗證安裝結(jié)果
    • cmd命令彈窗,輸入python ,點擊回車,看到下圖,則安裝python成功。
      在這里插入圖片描述

2.3.2 Anaconda3-2022.10-Windows-x86_64.exe安裝

  1. 選擇Just Me
    在這里插入圖片描述
  2. 自定義安裝路徑
    在這里插入圖片描述
  3. 只勾選Register,然后點擊Install。
    在這里插入圖片描述
  4. 去除這兩個勾選,然后點擊Finish
    在這里插入圖片描述

2.3.3 創(chuàng)建環(huán)境

1.查看Python版本
cmd打開命令行,輸入python --version,查驗python版本。
在這里插入圖片描述
2. 打開Anaconda Prompt頁面,輸入指令conda create -n py310 python=3.10(這里每個人不一樣,要根據(jù)查出來的版本做修改。)
在這里插入圖片描述
3. 看見如下圖的示例,表示環(huán)境創(chuàng)建完畢。
在這里插入圖片描述
4. 最后conda activate py310激活環(huán)境,看到左下角改變?yōu)?code>py310,代表進入該環(huán)境。
在這里插入圖片描述
5. 其他命令
- 退出激活的環(huán)境,conda deactivate
- 查看虛擬環(huán)境列表,conda env list。
- conda刪除環(huán)境,conda remove -n需要刪除的環(huán)境名 --all。

到這里,就代表anaconda的安裝配置全部完成。

2.3.4 Pytorch安裝

  1. conda配置
  • 更換鏡像源地址,以下是清華大學鏡像源地址:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
  • 把連接超時的時間設(shè)置成40s,讀取超時的時間修改成100s
conda config --set remote_connect_timeout_secs 40
conda config --set remote_read_timeout_secs 100
  • 配置文件位置:C:\Users\liuch\.condarc
channels:- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/- defaults
show_channel_urls: true
remote_connect_timeout_secs: 40.0
remote_read_timeout_secs: 100.0

注意:需要把 - defaults刪掉。

  1. 查看本機的CUDA版本
    cmd命令行輸入nvidia-smi,在第一行最右邊可以看到CUDA的版本號。
    在這里插入圖片描述
  2. 點擊進入Pytorch官網(wǎng),然后下拉至如圖所示位置,只需保證系統(tǒng)和電腦匹配,CUDA版本小于本機CUDA版本,調(diào)整結(jié)束后,復制紅框中的指令。
    conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
    

在這里插入圖片描述
4. 打開Anaconda Prompt,激活py310環(huán)境(conda activate py310),然后粘貼上一步的指令,回車執(zhí)行。
在這里插入圖片描述
5. 如果報OpenSSL錯誤

(py310) C:\Users\liuch>conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
Collecting package metadata (current_repodata.json): failedCondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.Exception: HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /pytorch/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

可去 https://slproweb.com/products/Win32OpenSSL.html 下載安裝包,注意最好下載Win64 OpenSSL v1.1.1w LightEXE,也就是低版本的,因為v3.x的安裝后依舊報錯。
在這里插入圖片描述
6. 輸入y確認,回車。
7. 等待安裝直到左上角出現(xiàn)done【下載依賴較多,耗時較長】。
在這里插入圖片描述
8. 輸入pip list,查看安裝了哪些包。
9. 輸入python進入環(huán)境,輸入import torch,無報錯代表導入成功(這里要等待一段時間)。
10. 輸入torch.cuda.is_available()查看torch是否可以使用顯卡,True代表可以。
在這里插入圖片描述
至此,Pytorch安裝完畢。

2.3.5 transformers

安裝最新版本:

pip install transformers

指定版本(推薦):

pip install transformers==4.34.0

輸入pip list,查看安裝了哪些包。
在這里插入圖片描述
至此,codeshell環(huán)境安裝完畢。

3 下載codeshell模型

在第二部分主要是搭建了codeshell使用環(huán)境,但是本地還沒有最底層的模型文件,所以需要單獨下載模型文件,才能真正使用codeshell。

目前有四個開源的模型如下:

  • CodeShell BaseCodelShell底座模型,具有強大的代碼基礎(chǔ)能力。
  • CodeShell ChatCodelShell對話模型,在代碼問答、代碼補全等下游任務(wù)重性能優(yōu)異。
  • CodeShell Chat 4bitCodelShell對話模型4bit量化版本,在保證模型性能的前提下內(nèi)存消耗更小,速度更快。
  • CodeShell CPPCodelShell對話模型CPP版本,支持開發(fā)者在沒有GPU的個人電腦中使用。注意,CPP版本同樣支持量化操作,用戶可以在最小內(nèi)存為8G的個人電腦中運行CodelShell。

其中有三個模型是在huggingface上托管:

  • WisdomShell/CodeShell-7B:對應(yīng)CodeShell Base。
  • WisdomShell/CodeShell-7B-Chat:對應(yīng)CodeShell Chat
  • WisdomShell/CodeShell-7B-Chat-int4:對應(yīng)CodeShell Chat 4bit。

所以需要從huggingface上下載下來。

git lfs install
git clone https://huggingface.co/WisdomShell/CodeShell-7B-Chat

4 codeshell使用

注意:這里是在py310環(huán)境使用的,所以需要先激活py310環(huán)境。

conda activate py310

4.1 Web UI

通過下列命令啟動Web服務(wù),服務(wù)啟動后,可以通過https://127.0.0.1:8000進行訪問。

python demos/web_demo.py
  1. 如果報錯提示缺少相關(guān)依賴模塊,使用pip install +模塊名稱下載安裝即可,例如報下錯誤:
(py310) E:\Python\codeshell>python demos/web_demo.py
Traceback (most recent call last):File "E:\Python\codeshell\demos\web_demo.py", line 28, in <module>import gradio as gr
ModuleNotFoundError: No module named 'gradio'

則需要安裝相關(guān)依賴,然后重新啟動:

pip install gradio
  1. 如果提示連接不上https://huggingface.co,需要開代理,或者將model下載到本地。

4.2 CLI Demo

python demos/cli_demo.py

5 總結(jié)

  1. 耗內(nèi)存
    4.1 Web UI4.2 CLI Demo使用時,可以看到占用內(nèi)存16943MB,即16.54GB。
    在這里插入圖片描述

  2. 響應(yīng)慢
    根據(jù)問題寫代碼時,很慢。

  3. 準確性 尚可

    1. golang語言實現(xiàn),輸入一個英文句子,反轉(zhuǎn)句子中單詞的順序,但單詞內(nèi)的字符順序不變,簡單起見,標點符號和普通單詞一樣處理。
    package mainimport ("fmt""strings"
    )func reverseWords(s string) string {words := strings.Fields(s)for i, j := 0, len(words)-1; i < j; i, j = i+1, j-1 {words[i], words[j] = words[j], words[i]}return strings.Join(words, " ")
    }func main() {s := "the weather is nice today."fmt.Println(reverseWords(s))
    }
    
    1. golang語言使用兩個協(xié)程交替打印數(shù)字和字母。
    package mainimport ("fmt""time"
    )func main() {// 創(chuàng)建兩個協(xié)程go printNumber()go printLetter()// 阻塞,直到協(xié)程完成for {// 休眠一段時間time.Sleep(1 * time.Second)}
    }func printNumber() {for i := 0; i < 10; i++ {fmt.Printf("%d ", i)time.Sleep(1 * time.Second)}
    }func printLetter() {for i := 'a'; i < 'z'; i++ {fmt.Printf("%c ", i)time.Sleep(1 * time.Second)}
    }
    
  4. 其他
    未測

個人目前覺得在配置較高的電腦運行可能會比較流暢,個人使用體驗不是很好。

http://m.risenshineclean.com/news/6785.html

相關(guān)文章:

  • 專業(yè)網(wǎng)站建設(shè)要多少錢快手流量推廣網(wǎng)站
  • 網(wǎng)站建設(shè)標準一長沙靠譜seo優(yōu)化
  • 對我單位網(wǎng)站進行改版百度seo排名優(yōu)
  • php開發(fā)做網(wǎng)站目前推廣軟件
  • 網(wǎng)站哪個做的好seo關(guān)鍵詞排行優(yōu)化教程
  • scratch少兒編程網(wǎng)站如何開通網(wǎng)站
  • 溫州二井建設(shè)有限公司網(wǎng)站免費刷seo
  • 宿州網(wǎng)站建設(shè)哪家公司好長沙網(wǎng)站推廣工具
  • 做婚紗網(wǎng)站的目的深圳搜索優(yōu)化排名
  • 軟件著作權(quán)查詢?nèi)肟诰W(wǎng)站如何做優(yōu)化推廣
  • 做家常菜的網(wǎng)站哪個好推廣seo是什么意思
  • 網(wǎng)站前瞻性 新流量機會內(nèi)容建設(shè)分析長沙網(wǎng)站制作推廣
  • 做網(wǎng)站時可以切換語言的適合推廣的app有哪些
  • 網(wǎng)頁設(shè)計與制作100例hbuiderx武漢搜索引擎排名優(yōu)化
  • 網(wǎng)站解除域名綁定互聯(lián)網(wǎng)品牌宣傳推廣服務(wù)公司
  • 旅游產(chǎn)業(yè)網(wǎng)站app建設(shè)的市場分析30個免費貨源網(wǎng)站
  • 長沙建站挺找有為太極百度seo軟件優(yōu)化
  • 網(wǎng)站公司文化怎么做成長電影在線觀看免費
  • 無錫 學校網(wǎng)站建設(shè)網(wǎng)站排行
  • 美食電子商務(wù)網(wǎng)站建設(shè)規(guī)劃書青島網(wǎng)絡(luò)優(yōu)化廠家
  • 網(wǎng)站用axure做的rp格式seo網(wǎng)頁推廣
  • 慈溪白云小學班級網(wǎng)站建設(shè)成都網(wǎng)站建設(shè)
  • 本地dedecms網(wǎng)站網(wǎng)絡(luò)培訓
  • 廣州企業(yè)網(wǎng)站建設(shè)費用武漢百度seo排名
  • 網(wǎng)站建設(shè) 后臺北京谷歌seo
  • 網(wǎng)站查詢域名ip解析免費推廣app平臺有哪些
  • 成都網(wǎng)站建設(shè)培訓班公關(guān)公司提供的服務(wù)有哪些
  • 國外做詳情頁網(wǎng)站營銷推廣手段有什么
  • 研究網(wǎng)站建設(shè)網(wǎng)絡(luò)營銷方式對比分析
  • 偷dede網(wǎng)站模板網(wǎng)站seo優(yōu)化技巧