书生·浦语训练营:第五讲 LmDeploy部署(作业部分)

本文详细介绍了如何在命令行和APIServer环境下配置LMDeploy,包括设置InternLM2-Chat-1.8B模型参数,如量化策略、KVCache占用比例,以及通过Python集成和视觉多模态应用llavatar-gradio-demo的部署过程。
摘要由CSDN通过智能技术生成

书生·浦语训练营:第五讲 LmDeploy部署(作业部分)

完成以下任务,并将实现过程记录截图:

  • 配置 LMDeploy 运行环境
  • 以命令行方式与 InternLM2-Chat-1.8B 模型对话

在这里插入图片描述
在这里插入图片描述

  • 设置KV Cache最大占用比例为0.4,开启W4A16量化,以命令行方式与模型对话。
- lmdeploy chat /root/internlm2-chat-1_8b-4bit --model-format awq --cache-max-entry-count 0.4

在这里插入图片描述

  • 以API Server方式启动 lmdeploy,开启 W4A16量化,调整KV Cache的占用比例为0.4,分别使用命令行客户端与Gradio网页客户端与模型对话。
lmdeploy serve api_server     /root/internlm2-chat-1_8b     --model-format hf     --quant-policy 0     --server-name 0.0.0.0     --server-port 23333     --tp 1 --cache-max-entry-count 0.4

在这里插入图片描述

  • 使用W4A16量化,调整KV Cache的占用比例为0.4,使用Python代码集成的方式运行internlm2-chat-1.8b模型。
from lmdeploy import pipeline, TurbomindEngineConfig

backend_config = TurbomindEngineConfig(cache_max_entry_count=0.4)

pipe = pipeline('/root/internlm2-chat-1_8b',
                backend_config=backend_config)
response = pipe(['Hi, pls intro yourself', '上海是'])
print(response)

在这里插入图片描述

  • 使用 LMDeploy 运行视觉多模态大模型 llava gradio demo。
  • 在这里插入图片描述
  • 7
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值