[Bug] internlm2_5-7b-chat多卡部署报错 aborted
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.
- [ ] 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
4卡T4的服务器,使用lmdeploy部署internlm2_5-7b-chat,张量并行tp=2 模型成功加载到显存,api接口服务正常。 调用推理接口,模型报错aborted,进程结束
使用internlm/internlm2_5-7b-chat-4bit,可以在单卡正常部署
Reproduction
使用modelscope
export LMDEPLOY_USE_MODELSCOPE=True
用cli工具部署服务
lmdeploy serve api_server Shanghai_AI_Laboratory/internlm2_5-7b-chat --backend turbomind --chat-template internlm2 --tp 2
用其他机器post请求推理接口
ip:23333/v1/chat/completions
{ "model": "/root/.cache/modelscope/hub/Shanghai_AI_Laboratory/internlm2_5-7b-chat", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "讲一个三国故事"} ], "temperature": 0.7, "top_p": 0.8 }
进程报错跳出
(lmdeploy) [root@local-gpu models]# lmdeploy serve api_server Shanghai_AI_Laboratory/internlm2_5-7b-chat --backend turbomind --chat-template internlm2 --tp 2 [WARNING] gemm_config.in is not found; using default GEMM algo [WARNING] gemm_config.in is not found; using default GEMM algo HINT: Please open http://0.0.0.0:23333 in a browser for detailed api usage!!! HINT: Please open http://0.0.0.0:23333 in a browser for detailed api usage!!! HINT: Please open http://0.0.0.0:23333 in a browser for detailed api usage!!! INFO: Started server process [32752] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:23333 (Press CTRL+C to quit) 已放弃
Environment
'(lmdeploy) [root@local-gpu models]# lmdeploy check_env
sys.platform: linux
Python: 3.8.19 (default, Mar 20 2024, 19:58:24) [GCC 11.2.0]
CUDA available: True
MUSA available: False
numpy_random_seed: 2147483648
GPU 0,1,2,3: Tesla T4
CUDA_HOME: /usr/local/cuda
NVCC: Cuda compilation tools, release 12.0, V12.0.140
GCC: gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
PyTorch: 2.3.1+cu121
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.3.6 (Git Hash 86e6af5974177e513fd3fee58425e1063e7f1361)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- LAPACK is enabled (usually provided by MKL)
- NNPACK is enabled
- CPU capability usage: AVX512
- CUDA Runtime 12.1
- 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 8.9.2
- Magma 2.6.1
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=12.1, CUDNN_VERSION=8.9.2, 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_QNNPACK -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.3.1, 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.18.1+cu121
LMDeploy: 0.6.0+
transformers: 4.44.2
gradio: Not Found
fastapi: 0.115.0
pydantic: 2.9.2
triton: 2.3.1
NVIDIA Topology:
GPU0 GPU1 GPU2 GPU3 CPU Affinity NUMA Affinity
GPU0 X NODE NODE SYS 0-15,32-47 0
GPU1 NODE X PHB SYS 0-15,32-47 0
GPU2 NODE PHB X SYS 0-15,32-47 0
GPU3 SYS SYS SYS X 16-31,48-63 1
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
(lmdeploy) [root@local-gpu models]# lmdeploy serve api_server Shanghai_AI_Laboratory/internlm2_5-7b-chat --backend turbomind --chat-template internlm2 --tp 2
[WARNING] gemm_config.in is not found; using default GEMM algo
[WARNING] gemm_config.in is not found; using default GEMM algo
HINT: Please open http://0.0.0.0:23333 in a browser for detailed api usage!!!
HINT: Please open http://0.0.0.0:23333 in a browser for detailed api usage!!!
HINT: Please open http://0.0.0.0:23333 in a browser for detailed api usage!!!
INFO: Started server process [32752]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:23333 (Press CTRL+C to quit)
已放弃
因为internlm/internlm2_5-7b-chat-4bit可以在单卡正常部署,我认为可能和显卡驱动和nccl有关
使用多卡推理internlm2_5-7b-chat-4bit
lmdeploy serve api_server /data/models/internlm-7b-chat-int4 --backend turbomind --model-format awq --chat-template internlm2 --tp 2
推理服务正常运行。所以大概能排除多卡推理的问题。
export TM_DEBUG_LEVEL=DEBUG 启动服务时,加上选项 --log-level=DEBUG, 看看日志报错在哪里
export TM_DEBUG_LEVEL=DEBUG 启动服务时,加上选项 --log-level=DEBUG, 看看日志报错在哪里
@lvhan028 这是日志最后的部分,报错大概是[TM][DEBUG] getPtr with type i4, but data type is: x
[TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = __nv_bfloat16] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = __nv_bfloat16] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: decoder_output [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: last_token_hidden_units [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = __nv_bfloat16] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = __nv_bfloat16] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: last_token_hidden_units [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = __nv_bfloat16] start [TM][DEBUG] run syncAndCheck at /lmdeploy/src/turbomind/models/llama/unified_decoder.cc:148 [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: input_query [TM][DEBUG] run syncAndCheck at /lmdeploy/src/turbomind/models/llama/unified_decoder.cc:148 [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: layer_id [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: input_query [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: cu_q_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: layer_id [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: cu_k_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: cu_q_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: h_cu_q_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: cu_k_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: h_cu_k_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: h_cu_q_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: hidden_features [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: h_cu_k_len [TM][DEBUG] void turbomind::UnifiedAttentionLayer<T>::forward(turbomind::TensorMap*, const turbomind::TensorMap*, const WeightType*) [with T = __nv_bfloat16; turbomind::UnifiedAttentionLayer<T>::WeightType = turbomind::LlamaAttentionWeight<__nv_bfloat16>] [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: hidden_features [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: input_query [TM][DEBUG] void turbomind::UnifiedAttentionLayer<T>::forward(turbomind::TensorMap*, const turbomind::TensorMap*, const WeightType*) [with T = __nv_bfloat16; turbomind::UnifiedAttentionLayer<T>::WeightType = turbomind::LlamaAttentionWeight<__nv_bfloat16>] [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: layer_id [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: input_query [TM][DEBUG] T turbomind::Tensor::getVal() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: layer_id [TM][DEBUG] T turbomind::Tensor::getVal(size_t) const [with T = int; size_t = long unsigned int] start [TM][DEBUG] T turbomind::Tensor::getVal() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: dc_batch_size [TM][DEBUG] T turbomind::Tensor::getVal(size_t) const [with T = int; size_t = long unsigned int] start [TM][DEBUG] T turbomind::Tensor::getVal() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: dc_batch_size [TM][DEBUG] T turbomind::Tensor::getVal(size_t) const [with T = int; size_t = long unsigned int] start [TM][DEBUG] T turbomind::Tensor::getVal() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: pf_batch_size [TM][DEBUG] T turbomind::Tensor::getVal(size_t) const [with T = int; size_t = long unsigned int] start [TM][DEBUG] T turbomind::Tensor::getVal() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: pf_batch_size [TM][DEBUG] T turbomind::Tensor::getVal(size_t) const [with T = int; size_t = long unsigned int] start [TM][DEBUG] T turbomind::Tensor::getVal() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: h_q_len [TM][DEBUG] T turbomind::Tensor::getVal(size_t) const [with T = int; size_t = long unsigned int] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: h_q_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: h_k_len [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: h_k_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: cu_q_len [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: cu_q_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: cu_k_len [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: cu_k_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: h_cu_q_len [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: h_cu_q_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: h_cu_k_len [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: h_cu_k_len [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: finished [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = bool] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: finished [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: rope_theta [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = bool] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = float] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: rope_theta [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: block_ptrs [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = float] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = void*] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: block_ptrs [TM][DEBUG] getPtr with type x, but data type is: u8 [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = void*] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: cu_block_counts [TM][DEBUG] getPtr with type x, but data type is: u8 [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: cu_block_counts [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: input_query [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = __nv_bfloat16] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: input_query [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: hidden_features [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = __nv_bfloat16] start [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = __nv_bfloat16] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: hidden_features [TM][DEBUG] void turbomind::UnifiedAttentionLayer<T>::allocateBuffer(size_t, size_t, size_t, const WeightType*) [with T = __nv_bfloat16; size_t = long unsigned int; turbomind::UnifiedAttentionLayer<T>::WeightType = turbomind::LlamaAttentionWeight<__nv_bfloat16>] [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = __nv_bfloat16] start [TM][DEBUG] void* turbomind::IAllocator::reMalloc(T*, size_t, bool, bool) [with T = __nv_bfloat16; size_t = long unsigned int] [TM][DEBUG] void turbomind::UnifiedAttentionLayer<T>::allocateBuffer(size_t, size_t, size_t, const WeightType*) [with T = __nv_bfloat16; size_t = long unsigned int; turbomind::UnifiedAttentionLayer<T>::WeightType = turbomind::LlamaAttentionWeight<__nv_bfloat16>] [TM][DEBUG] Cannot find buffer (nil), mallocing new one. [TM][DEBUG] void* turbomind::IAllocator::reMalloc(T*, size_t, bool, bool) [with T = __nv_bfloat16; size_t = long unsigned int] [TM][DEBUG] virtual void* turbomind::Allocatorturbomind::AllocatorType::CUDA::malloc(size_t, bool, bool) [TM][DEBUG] Cannot find buffer (nil), mallocing new one. [TM][DEBUG] virtual void* turbomind::Allocatorturbomind::AllocatorType::CUDA::malloc(size_t, bool, bool) [TM][DEBUG] malloc buffer 0x6d0394400 with size 153600 [TM][DEBUG] void* turbomind::IAllocator::reMalloc(T*, size_t, bool, bool) [with T = __nv_bfloat16; size_t = long unsigned int] [TM][DEBUG] Cannot find buffer (nil), mallocing new one. [TM][DEBUG] malloc buffer 0xe1a394400 with size 153600 [TM][DEBUG] virtual void* turbomind::Allocatorturbomind::AllocatorType::CUDA::malloc(size_t, bool, bool) [TM][DEBUG] void* turbomind::IAllocator::reMalloc(T*, size_t, bool, bool) [with T = __nv_bfloat16; size_t = long unsigned int] [TM][DEBUG] malloc buffer 0x6d03b9c00 with size 102400 [TM][DEBUG] Cannot find buffer (nil), mallocing new one. [TM][DEBUG] void* turbomind::IAllocator::reMalloc(T*, size_t, bool, bool) [with T = __nv_bfloat16; size_t = long unsigned int] [TM][DEBUG] virtual void* turbomind::Allocatorturbomind::AllocatorType::CUDA::malloc(size_t, bool, bool) [TM][DEBUG] Cannot find buffer (nil), mallocing new one. [TM][DEBUG] malloc buffer 0xe1a3b9c00 with size 102400 [TM][DEBUG] virtual void* turbomind::Allocatorturbomind::AllocatorType::CUDA::malloc(size_t, bool, bool) [TM][DEBUG] void* turbomind::IAllocator::reMalloc(T*, size_t, bool, bool) [with T = __nv_bfloat16; size_t = long unsigned int] [TM][DEBUG] Cannot find buffer (nil), mallocing new one. [TM][DEBUG] malloc buffer 0x6d03d2c00 with size 182272 [TM][DEBUG] virtual void* turbomind::Allocatorturbomind::AllocatorType::CUDA::malloc(size_t, bool, bool) [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: lora_mask [TM][DEBUG] malloc buffer 0xe1a3d2c00 with size 182272 [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] bool turbomind::TensorMap::isExist(const string&) const for key: lora_mask [TM][DEBUG] T* turbomind::Tensor::getPtr() const [with T = int] start [TM][DEBUG] getPtr with type i4, but data type is: x [TM][DEBUG] getPtr with type i4, but data type is: x [TM][DEBUG] void turbomind::cublasMMWrapper::Gemm(cublasOperation_t, cublasOperation_t, int, int, int, const void*, int, const void*, int, void*, int, float, float) [TM][DEBUG] void turbomind::cublasMMWrapper::Gemm(cublasOperation_t, cublasOperation_t, int, int, int, const void*, int, const void*, int, void*, int, float, float) [TM][DEBUG] run syncAndCheck at /lmdeploy/src/turbomind/utils/cublasMMWrapper.cc:326 [TM][DEBUG] run syncAndCheck at /lmdeploy/src/turbomind/models/llama/LlamaLinear.cu:105 [TM][DEBUG] run syncAndCheck at /lmdeploy/src/turbomind/models/llama/unified_attention_layer.cc:217 [TM][DEBUG] run syncAndCheck at /lmdeploy/src/turbomind/utils/cublasMMWrapper.cc:326 [TM][DEBUG] run syncAndCheck at /lmdeploy/src/turbomind/models/llama/LlamaLinear.cu:105 [TM][DEBUG] run syncAndCheck at /lmdeploy/src/turbomind/models/llama/unified_attention_layer.cc:217 [TM][DEBUG] run syncAndCheck at /lmdeploy/src/turbomind/models/llama/unified_attention_layer.cc:346 [TM][DEBUG] run syncAndCheck at /lmdeploy/src/turbomind/models/llama/unified_attention_layer.cc:346 [TM][DEBUG] run syncAndCheck at /lmdeploy/src/turbomind/models/llama/unified_attention_layer.cc:350 [TM][DEBUG] run syncAndCheck at /lmdeploy/src/turbomind/models/llama/unified_attention_layer.cc:350 已放弃
请问你解决了吗,遇到了同样的问题。。。
请问你解决了吗,遇到了同样的问题。。。
没有解决
我这边没有T4卡,A100 上复现不了。 @irexyc 能看出什么眉目不?