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

推荐订阅源

博客园 - 聂微东
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Privacy International News Feed
NISL@THU
NISL@THU
Know Your Adversary
Know Your Adversary
G
GRAHAM CLULEY
The Hacker News
The Hacker News
P
Privacy & Cybersecurity Law Blog
S
Schneier on Security
T
Troy Hunt's Blog
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
S
Security Affairs
WordPress大学
WordPress大学
T
Tailwind CSS Blog
博客园 - Franky
T
The Exploit Database - CXSecurity.com
雷峰网
雷峰网
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
S
Securelist
A
Arctic Wolf
C
Cyber Attacks, Cyber Crime and Cyber Security
有赞技术团队
有赞技术团队
爱范儿
爱范儿
Help Net Security
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 三生石上(FineUI控件)
C
CERT Recently Published Vulnerability Notes
C
Cisco Blogs
阮一峰的网络日志
阮一峰的网络日志
C
Cybersecurity and Infrastructure Security Agency CISA
Spread Privacy
Spread Privacy
Last Week in AI
Last Week in AI
S
Security @ Cisco Blogs
博客园 - 司徒正美
博客园_首页
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
罗磊的独立博客
博客园 - 叶小钗
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
大猫的无限游戏
大猫的无限游戏
Jina AI
Jina AI
J
Java Code Geeks
T
Threatpost
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
量子位

博客园 - 尘梦

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