InternLM / lmdeploy

LMDeploy is a toolkit for compressing, deploying, and serving LLMs.
https://lmdeploy.readthedocs.io/en/latest/
Apache License 2.0
3.99k stars 363 forks source link

用lmdeploy部署internlm2_5-7B-chat请求返回为空 #1991

Open wwwyfff opened 1 month ago

wwwyfff commented 1 month ago

📚 The doc issue

Code部分:

def generate_QA():
    server_addr = "..."
    client = APIClient(server_addr, api_key=None)
    model_name = client.available_models[0]

    req = "你是一位善于总结文本大纲的机器人,你的任务是按照以下步骤分析长文本内容,并按照要求进行输出......"

    prompt = [{"role": "user", "content": req}]

    top_p = 0.9
    temperature = 0.7
    output_seqlen = 4096
    stream_output = False

    for response in client.chat_completions_v1(model=model_name, messages=prompt, temperature=temperature, top_p=top_p, n=1, max_tokens=output_seqlen, stream=stream_output, ignore_eos=False):
        print(response)
        output = response["choices"][0]['message']['content']

    return output

print(generate_QA())

如果我的prompt是比较简单的问题。比如“介绍一下自己”,返回结果就不为空,但如果prompt较为复杂,返回结果就是空值。如下图: image

image

image

Suggest a potential alternative/fix

No response

lvhan028 commented 1 month ago

日志中显示 “CUDA runtime error: out of memory” 麻烦执行命令 "lmdeploy check_env",把环境信息贴上来吧

wwwyfff commented 1 month ago

日志中显示 “CUDA runtime error: out of memory” 麻烦执行命令 "lmdeploy check_env",把环境信息贴上来吧

您好!这是我的环境信息。麻烦您了。 sys.platform: linux Python: 3.9.19 (main, May 6 2024, 19:43:03) [GCC 11.2.0] CUDA available: True MUSA available: False numpy_random_seed: 2147483648 GPU 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15: NVIDIA L4 CUDA_HOME: None GCC: gcc (Ubuntu 13.2.0-4ubuntu3) 13.2.0 PyTorch: 2.2.2+cu121 PyTorch compiling details: PyTorch built with:

TorchVision: 0.17.2+cu121 LMDeploy: 0.5.0+ transformers: 4.42.3 gradio: Not Found fastapi: 0.111.0 pydantic: 2.8.2 triton: 2.2.0

lvhan028 commented 1 month ago

查了下L4的信息,内存是 24G 的 推理引擎的default配置不太合适。还请提供如下信息,方便我们给一个合适的配置。

  1. 上下文的长度是多少
  2. server需要支持多少并发
wwwyfff commented 1 month ago

查了下L4的信息,内存是 24G 的 推理引擎的default配置不太合适。还请提供如下信息,方便我们给一个合适的配置。

  1. 上下文的长度是多少
  2. server需要支持多少并发

单机16卡 上下文长度128k 并发1

谢谢

lvhan028 commented 1 month ago

你用的server的启动命令是怎样的呢?

wwwyfff commented 1 month ago

你用的server的启动命令是怎样的呢?

CUDA_VISIBLE_DEVICES=6,9 lmdeploy serve api_server ./workspace --server-port 35010 --tp 2

CUDA_VISIBLE_DEVICES=6,9 lmdeploy serve api_server internlm2_5-7b-chat-1m-4bit/ --server-port 35010 --tp 2 --model-format awq

应该是第一个,后面准备试一下量化的版本