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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & 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