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

推荐订阅源

C
Check Point Blog
U
Unit 42
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Martin Fowler
Martin Fowler
L
LangChain Blog
博客园_首页
博客园 - 【当耐特】
Vercel News
Vercel News
I
InfoQ
GbyAI
GbyAI
爱范儿
爱范儿
D
DataBreaches.Net
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Proofpoint News Feed
美团技术团队
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
H
Help Net Security
Recent Announcements
Recent Announcements
Microsoft Azure Blog
Microsoft Azure Blog
D
Docker
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
量子位
小众软件
小众软件
J
Java Code Geeks
S
SegmentFault 最新的问题
Engineering at Meta
Engineering at Meta
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
The Cloudflare Blog
Recorded Future
Recorded Future
阮一峰的网络日志
阮一峰的网络日志
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
Microsoft Security Blog
Microsoft Security Blog

博客园 - 尘梦

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