惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
量子位
L
LINUX DO - 最新话题
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Jina AI
Jina AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
博客园 - 聂微东
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
G
Google Developers Blog
MyScale Blog
MyScale Blog
罗磊的独立博客
Martin Fowler
Martin Fowler
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
H
Help Net Security
H
Hacker News: Front Page
博客园 - Franky
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
AI
AI
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Recent Commits to openclaw:main
Recent Commits to openclaw:main
TaoSecurity Blog
TaoSecurity Blog
O
OpenAI News
Latest news
Latest news
T
Threat Research - Cisco Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
L
LINUX DO - 热门话题
Spread Privacy
Spread Privacy
I
Intezer
Scott Helme
Scott Helme
MongoDB | Blog
MongoDB | Blog
C
Cybersecurity and Infrastructure Security Agency CISA
P
Palo Alto Networks Blog
A
Arctic Wolf
AWS News Blog
AWS News Blog
S
Schneier on Security
Y
Y Combinator Blog
月光博客
月光博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - 尘梦

calude code 2.188 根据cli.map还原 centos6 安装gcc 多版本 自定义编译bulma 神通mysql模式转 mysql ai数学书籍 chromedriver 网络安全渗透测试写法 编译php需要的扩展 python 合并同列数据 组合 新的excel vue table 表格记录选中 linux wktohtmlpdf 结合/tmp路径 无法创建问题 c语言开发 php扩展 sm4 macos php 如何链接神通数据库aci layui table tr a标签倒计时 操作 刷新以后继续倒计时 使用c# 开发 php的com组件 世界级地图数据处理 及 联动效果 php 结合pcntl_fork导出excel数据 使用 macos 下连接php 人大金仓pdo_kdb问题 php curl 多次发送
python 部署chatglm2b
尘梦 · 2023-10-24 · via 博客园 - 尘梦

下载模型实现 然后手动下载模型 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/THUDM/chatglm2-6b

cd ChatGLM2-6B

mkdir modelsglm && cd modelsglm

vim downs.py

# coding=utf-8
import requests


url1='https://cloud.tsinghua.edu.cn/d/674208019e314311ab5c/files/?p=%2Fchatglm2-6b%2Fpytorch_model-0000'
url2='-of-00007.bin&dl=1'
save_path1='pytorch_model-0000'
save_path2='-of-00007.bin'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'}
# 循环获取models,总共有7个基础模型
for i in range(7):
    url=url1+str(i+1)+url2
    print(url)
    save_path=save_path1+str(i+1)+save_path2
    res = requests.get(url,headers=headers)


    file1 =open(save_path,'wb')
    file1.write(res.content)
    file1.close()
    print("第{}个模型下载已完成".format(i+1))

python downs.py

等待模型下载完成

sudo vim web_demo.py

tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm2-6b", trust_remote_code=True)
model = AutoModel.from_pretrained("THUDM/chatglm2-6b", trust_remote_code=True).cuda()

替换为

tokenizer = AutoTokenizer.from_pretrained(/modelglm", trust_remote_code=True)
model = AutoModel.from_pretrained("/modelglm", trust_remote_code=True).cuda()

这个按需添加吧 如果报错的话就加这个

export LD_LIBRARY_PATH=(python的cuda的路径):$LD_LIBRARY_PATH
pip install torchvision==0.15.2+cu118 --index-url https://download.pytorch.org/whl/cu118

torch-2.0.1%2Bcu118-cp311-cp311-linux_x86_64.whl

torchvision-0.15.2+cu118-cp311-cp311-linux_x86_64.whl

torchaudio-2.0.1%2Bcu118-cp311-cp311-linux_x86_64.whl

pip install torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu118

nohup pip install torch2.0.1+cu118 torchvision0.15.2+cu118 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu118 > myoutput.file 2>&1 &

pip install torch2.0.1+cu118 torchvision0.15.2+cu118 torchaudio==2.0.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

原始版本

demo.queue().launch(share=False, inbrowser=True)

替换这个
demo.queue().launch(share=False, inbrowser=True,server_name="0.0.0.0",server_port=8898)

demo.queue().launch(server_name="0.0.0.0", server_port=8898)

如果前端出现问题

删除pip uninstall gradio

请安装 pip install gradio==3.39.0

后台运行 nohup python web_demo.py > /dev/null 2>&1