Skip to content
life

最近两年深陷大模型泡沫中.......😇

Menu
  • 关于我
Menu

书生浦语大模型_LMDeploy 量化部署 LLM&VLM实战

Posted on 2024年4月12日

全部笔记写在 github 上

LMDeploy 量化部署 LLM&VLM实战

设置KV Cache最大占用比例为0.4,开启W4A16量化,以命令行方式与模型对话。(优秀学员必做)

lmdeploy chat /root/internlm2-chat-1_8b-4bit --model-format awq --cache-max-entry-count 0.4
  • 提问截图
    2024-04-12-09-54

以API Server方式启动 lmdeploy,开启 W4A16量化,调整KV Cache的占用比例为0.4,分别使用命令行客户端与Gradio网页客户端与模型对话。

# lmdeploy serve api_server -h  #查看参数

lmdeploy serve api_server \
    /root/internlm2-chat-1_8b-4bit \
    --model-format awq \
    --server-name 0.0.0.0 \
    --server-port 23333 \
    --tp 1 \
    --cache-max-entry-count 0.4
  • 命令行客户端
lmdeploy serve api_client http://localhost:23333
  • 截图
    2024-04-12-10-04

  • Gradio网页客户端
    ~~ 报错 DeprecationWarning: concurrency_count has been deprecated. Set the concurrency_limit directly on event listeners e.g. btn.click(fn, ..., concurrency_limit=10) or gr.Interface(concurrency_limit=10). If necessary, the total number of workers can be configured via max_threads in launch(). ~~
# lmdeploy serve gradio --help 
lmdeploy serve gradio http://localhost:23333 \
    --server-name 0.0.0.0 \
    --server-port 6006

使用W4A16量化,调整KV Cache的占用比例为0.4,使用Python代码集成的方式运行internlm2-chat-1.8b模型。(优秀学员必做)


from lmdeploy import pipeline, TurbomindEngineConfig

# 调低 k/v cache内存占比调整为总显存的 40%
backend_config = TurbomindEngineConfig(cache_max_entry_count=0.4,model_format='awq')

pipe = pipeline('/root/internlm2-chat-1_8b-4bit',
                backend_config=backend_config)
response = pipe(['青岛是'])

print(response)

2024-04-12-10-39

使用 LMDeploy 运行视觉多模态大模型 llava gradio demo (优秀学员必做)

2024-04-12-09-18

将 LMDeploy Web Demo 部署到 OpenXLab (OpenXLab cuda 12.2 的镜像还没有 ready,可先跳过,一周之后再来做)

发表回复 取消回复

您的邮箱地址不会被公开。 必填项已用 * 标注

近期文章

  • 最近4年一顿操作猛如虎,基金赔了几个月工资
  • 2025-06-10Apple WWDC 2025总结
  • 最近看的热门文章
  • 读文章My AI Skeptic Friends Are All Nuts热评
  • 中国宣布计划用水印和元数据标记所有AI生成的内容

近期评论

  1. tianyou 发表在 中国宣布计划用水印和元数据标记所有AI生成的内容
  2. animous 发表在 你的Ollama正在被别人调用—Ollama安全漏洞
  3. jingzy 发表在 你的Ollama正在被别人调用—Ollama安全漏洞
  4. wangminsheng 发表在 东荆家村村主任荆方友收回耕地堆放秸秆垃圾,离谱不?
  5. jingzy 发表在 博客升级-2023

归档

  • 2025 年 6 月
  • 2025 年 3 月
  • 2025 年 2 月
  • 2024 年 4 月
  • 2024 年 1 月
  • 2023 年 10 月
  • 2023 年 9 月
  • 2023 年 8 月
  • 2023 年 7 月

分类

  • devops
  • LLM
  • 基金
  • 想法
  • 新闻
  • 日记
  • 未分类
  • 社交媒体
  • 程序员之道
©2025 程序员小荆 备案号 鲁ICP备20007351号 20007351