Skip to content

[Bug] lmdeploy serve api_server 方式部署指定 chat-template 报错 #4533

Closed

Description

@LiYtao

Checklist

  • 1. I have searched related issues but cannot get the expected help.
  • 2. The bug has not been fixed in the latest version.
  • 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.

Describe the bug

lmdeploy 0.12.2版本
启动指令:
python3 -m lmdeploy serve api_server /data/model/qwen3 --tp 1 --backend pytorch --cache-max-entry-count 0.5 --chat-template qwen3-vl --log-level INFO --session-len 16384 --vision-max-batch-size 1

错误:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/site-packages/lmdeploy/main.py", line 5, in
run()
File "/usr/local/lib/python3.10/site-packages/lmdeploy/cli/entrypoint.py", line 39, in run
args.run(args)
File "/usr/local/lib/python3.10/site-packages/lmdeploy/cli/serve.py", line 270, in api_server
chat_template_config = get_chat_template(args.chat_template, args.model_path)
File "/usr/local/lib/python3.10/site-packages/lmdeploy/cli/utils.py", line 85, in get_chat_template
from lmdeploy.model import DEPRECATED_CHAT_TEMPLATE_NAMES, MODELS, REMOVED_CHAT_TEMPLATE_NAMES
ImportError: cannot import name 'DEPRECATED_CHAT_TEMPLATE_NAMES' from 'lmdeploy.model' (/usr/local/lib/python3.10/site-packages/lmdeploy/model.py)

Reproduction

python3 -m lmdeploy serve api_server /data/model/qwen3 --tp 1 --backend pytorch --cache-max-entry-count 0.5 --chat-template qwen3-vl --log-level INFO --session-len 16384 --vision-max-batch-size 1

Environment

lmdeploy check_env
sys.platform: linux
Python: 3.10.0 (default, Nov  4 2024, 06:13:04) [GCC 7.5.0]
CUDA available: True
MUSA available: False
numpy_random_seed: 2147483648
GPU 0,1,2,3,4,5,6,7: NVIDIA A100-PCIE-40GB
CUDA_HOME: /usr/local/cuda
NVCC: Cuda compilation tools, release 11.8, V11.8.89
GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
PyTorch: 2.4.0+cu118
PyTorch compiling details: PyTorch built with:
  - GCC 9.3
  - C++ Version: 201703
  - Intel(R) oneAPI Math Kernel Library Version 2022.2-Product Build 20220804 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v3.4.2 (Git Hash 1137e04ec0b5251ca2b4400a4fd3c667ce843d67)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - LAPACK is enabled (usually provided by MKL)
  - NNPACK is enabled
  - CPU capability usage: AVX512
  - CUDA Runtime 11.8
  - NVCC architecture flags: -gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_90,code=sm_90
  - CuDNN 90.1
  - Magma 2.6.1
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.8, CUDNN_VERSION=9.1.0, CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 -fabi-version=11 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-stringop-overflow -Wsuggest-override -Wno-psabi -Wno-error=pedantic -Wno-error=old-style-cast -Wno-missing-braces -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=2.4.0, USE_CUDA=ON, USE_CUDNN=ON, USE_CUSPARSELT=1, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_GLOO=ON, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=1, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF,

TorchVision: 0.19.0+cu118
LMDeploy: 0.12.2+
transformers: 4.57.3
fastapi: 0.115.4
pydantic: 2.13.1
triton: 3.0.0
NVIDIA Topology:
	GPU0	GPU1	GPU2	GPU3	GPU4	GPU5	GPU6	GPU7	NIC0	NIC1	CPU Affinity	NUMA Affinity
GPU0	 X 	PIX	PIX	PIX	SYS	SYS	SYS	SYS	PIX	PIX	0-23,48-71	0
GPU1	PIX	 X 	PIX	PIX	SYS	SYS	SYS	SYS	PIX	PIX	0-23,48-71	0
GPU2	PIX	PIX	 X 	PIX	SYS	SYS	SYS	SYS	PIX	PIX	0-23,48-71	0
GPU3	PIX	PIX	PIX	 X 	SYS	SYS	SYS	SYS	PIX	PIX	0-23,48-71	0
GPU4	SYS	SYS	SYS	SYS	 X 	PIX	PIX	PIX	SYS	SYS	24-47,72-95	1
GPU5	SYS	SYS	SYS	SYS	PIX	 X 	PIX	PIX	SYS	SYS	24-47,72-95	1
GPU6	SYS	SYS	SYS	SYS	PIX	PIX	 X 	PIX	SYS	SYS	24-47,72-95	1
GPU7	SYS	SYS	SYS	SYS	PIX	PIX	PIX	 X 	SYS	SYS	24-47,72-95	1
NIC0	PIX	PIX	PIX	PIX	SYS	SYS	SYS	SYS	 X 	PIX
NIC1	PIX	PIX	PIX	PIX	SYS	SYS	SYS	SYS	PIX	 X

Legend:

  X    = Self
  SYS  = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
  NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
  PHB  = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
  PXB  = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
  PIX  = Connection traversing at most a single PCIe bridge
  NV#  = Connection traversing a bonded set of # NVLinks

NIC Legend:

  NIC0: mlx5_0
  NIC1: mlx5_1

Error traceback

lmdeploy/cli/utils.py:85 有 from lmdeploy.model import DEPRECATED_CHAT_TEMPLATE_NAMES, MODELS, REMOVED_CHAT_TEMPLATE_NAMES

但是 DEPRECATED_CHAT_TEMPLATE_NAMES和REMOVED_CHAT_TEMPLATE_NAMES似乎从 v0.12.0开始从 lmdeploy/model.py 中删除了
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions