lmdeploy icon indicating copy to clipboard operation
lmdeploy copied to clipboard

[Bug] Crashes when using turbomind engine for inference on Qwen/Qwen2.5-VL-3B-Instruct model

Open mizuikki opened this issue 1 year ago • 2 comments

Checklist

  • [x] 1. I have searched related issues but cannot get the expected help.
  • [x] 2. The bug has not been fixed in the latest version.
  • [x] 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

When using the latest source code from the main branch to build (qwen_vl_utils)the Docker image, it crashes when executing the command lmdeploy serve api_server Qwen/Qwen2.5-VL-3B-Instruct.

Reproduction

lmdeploy serve api_server Qwen/Qwen2.5-VL-3B-Instruct lmdeploy serve api_server --tp 2 Qwen/Qwen2.5-VL-3B-Instruct

Environment

GPU: Tesla V100
Model: Qwen/Qwen2.5-VL-3B-Instruct

sys.platform: linux
Python: 3.10.12 (main, May 27 2025, 17:12:29) [GCC 11.4.0]
CUDA available: True
MUSA available: False
numpy_random_seed: 2147483648
GPU 0,1: Tesla V100-SXM2-16GB
CUDA_HOME: /usr/local/cuda
NVCC: Cuda compilation tools, release 12.4, V12.4.131
GCC: x86_64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
PyTorch: 2.7.1+cu126
PyTorch compiling details: PyTorch built with:
  - GCC 11.2
  - C++ Version: 201703
  - Intel(R) oneAPI Math Kernel Library Version 2024.2-Product Build 20240605 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v3.7.1 (Git Hash 8d263e693366ef8db40acc569cc7d8edf644556d)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - LAPACK is enabled (usually provided by MKL)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 12.6
  - 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_90,code=sm_90
  - CuDNN 90.5.1
  - Magma 2.6.1
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, COMMIT_SHA=e2d141dbde55c2a4370fac5165b0561b6af4798b, CUDA_VERSION=12.6, CUDNN_VERSION=9.5.1, CXX_COMPILER=/opt/rh/gcc-toolset-11/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=1 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DLIBKINETO_NOXPUPTI=ON -DUSE_FBGEMM -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=range-loop-construct -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-unused-parameter -Wno-strict-overflow -Wno-strict-aliasing -Wno-stringop-overflow -Wsuggest-override -Wno-psabi -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -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, TORCH_VERSION=2.7.1, USE_CUDA=ON, USE_CUDNN=ON, USE_CUSPARSELT=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.22.1+cu126
LMDeploy: 0.9.1+b0b705f
transformers: 4.54.0.dev0
gradio: 5.38.0
fastapi: 0.116.1
pydantic: 2.11.7
triton: 3.3.1
NVIDIA Topology:
        GPU0    GPU1    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      PHB     0-11    0               N/A
GPU1    PHB      X      0-11    0               N/A

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

Error traceback

2025-07-23 17:47:27,618 - lmdeploy - INFO - builder.py:65 - matching vision model: Qwen2VLModel
Using a slow image processor as `use_fast` is unset and a slow processor was saved with this model. `use_fast=True` will be the default behavior in v4.52, even if the model was saved with
 slow processor. This will result in minor differences in outputs. You'll still be able to use a slow processor with `use_fast=False`.
You have video processor config saved in `preprocessor.json` file which is deprecated. Video processor configs should be saved in their own `video_preprocessor.json` file. You can rename t
e file or load and save the processor back which renames it automatically. Loading from `preprocessor.json` will be removed in v5.0.
Traceback (most recent call last):
  File "/opt/py3/bin/lmdeploy", line 8, in <module>
    sys.exit(run())
  File "/opt/lmdeploy/lmdeploy/cli/entrypoint.py", line 39, in run
    args.run(args)
  File "/opt/lmdeploy/lmdeploy/cli/serve.py", line 371, in api_server
    run_api_server(args.model_path,
  File "/opt/lmdeploy/lmdeploy/serve/openai/api_server.py", line 1351, in serve
    VariableInterface.async_engine = pipeline_class(model_path=model_path,
  File "/opt/lmdeploy/lmdeploy/serve/vl_async_engine.py", line 31, in __init__
    self.vl_encoder = ImageEncoder(model_path, backend, vision_config, backend_config=backend_config)
  File "/opt/lmdeploy/lmdeploy/vl/engine.py", line 36, in __init__
    self.model = load_vl_model(model_path, backend, backend_config=backend_config)
  File "/opt/lmdeploy/lmdeploy/vl/model/builder.py", line 71, in load_vl_model
    model.build_model()
  File "/opt/lmdeploy/lmdeploy/vl/model/qwen2.py", line 84, in build_model
    load_checkpoint_and_dispatch(model=model,
  File "/opt/py3/lib/python3.10/site-packages/accelerate/big_modeling.py", line 642, in load_checkpoint_and_dispatch
    return dispatch_model(
  File "/opt/py3/lib/python3.10/site-packages/accelerate/big_modeling.py", line 491, in dispatch_model
    device = list(device_map.values())[0]
IndexError: list index out of range

mizuikki avatar Jul 23 '25 18:07 mizuikki

try transformers==4.49.0

kolmogorov-quyet avatar Jul 24 '25 04:07 kolmogorov-quyet

@mizuikk I can reproduce this error with transformers==4.52.0 and will check this. You can use transformers==4.49.0 for now.

irexyc avatar Jul 24 '25 07:07 irexyc