lmdeploy icon indicating copy to clipboard operation
lmdeploy copied to clipboard

[Bug] 为什么qwen3VL的logits、last_hidden_state不支持返回呢?

Open FangdongWang opened this issue 8 months ago • 3 comments

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

gen_config=GenerationConfig(
        temperature=0.0,
        top_k = 1,
        output_logits='generation',
        output_last_hidden_state='generation',
        max_new_tokens=2048)
    
    # pipe = pipeline(args.model_path, backend_config=backend_config)
    pipe = pipeline(args.model_path)

    response = pipe(['Hi, pls intro yourself', 'Shanghai is'],
                gen_config=gen_config)
    hidden_states = [x.last_hidden_state for x in response]
    logits = [x.logits for x in response]

    # pdb.set_trace()
    print(hidden_states)
    print(logits)

Reproduction

gen_config=GenerationConfig(
        temperature=0.0,
        top_k = 1,
        output_logits='generation',
        output_last_hidden_state='generation',
        max_new_tokens=2048)
    
    # pipe = pipeline(args.model_path, backend_config=backend_config)
    pipe = pipeline(args.model_path)

    response = pipe(['Hi, pls intro yourself', 'Shanghai is'],
                gen_config=gen_config)
    hidden_states = [x.last_hidden_state for x in response]
    logits = [x.logits for x in response]

    # pdb.set_trace()
    print(hidden_states)
    print(logits)

Environment

官方环境

Error traceback


FangdongWang avatar Mar 30 '26 09:03 FangdongWang

用的是哪个backend呢? 麻烦执行 lmdeploy check_env,贴下环境信息

lvhan028 avatar Mar 30 '26 15:03 lvhan028

`

from lmdeploy import pipeline, GenerationConfig, PytorchEngineConfig    
processor = AutoProcessor.from_pretrained(args.model_path)
    
backend_config = PytorchEngineConfig(
    tp=1,
    session_len=8192
)

gen_config=GenerationConfig(
    temperature=0.0,
    top_k = 1,
    output_logits='generation',
    output_last_hidden_state='generation',
    max_new_tokens=2048)

pipe = pipeline(args.model_path, backend_config=backend_config)

response = pipe(['Hi, pls intro yourself', 'Shanghai is'],
            gen_config=gen_config)
hidden_states = [x.last_hidden_state for x in response]
logits = [x.logits for x in response]

# pdb.set_trace()
print(hidden_states)
print(logits)

`

` sys.platform: linux Python: 3.12.13 | packaged by conda-forge | (main, Mar 5 2026, 16:50:00) [GCC 14.3.0] CUDA available: True MUSA available: False numpy_random_seed: 2147483648 GPU 0,1,2,3,4,5,6,7: NVIDIA A800-SXM4-40GB CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 12.6, V12.6.85 GCC: gcc (Debian 12.2.0-14+deb12u1) 12.2.0 PyTorch: 2.8.0+cu128 PyTorch compiling details: PyTorch built with: - GCC 13.3 - 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: AVX512 - CUDA Runtime 12.8 - NVCC architecture flags: -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;-gencode;arch=compute_100,code=sm_100;-gencode;arch=compute_120,code=sm_120 - CuDNN 90.7.1 - Built with CuDNN 90.8 - Magma 2.6.1 - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, COMMIT_SHA=a1cb3cc05d46d198467bebbb6e8fba50a325d4e7, CUDA_VERSION=12.8, CUDNN_VERSION=9.8.0, CXX_COMPILER=/opt/rh/gcc-toolset-13/root/usr/bin/c++, CXX_FLAGS= -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 -DC10_NODEPRECATED -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 -faligned-new -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-dangling-reference -Wno-error=dangling-reference -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, TORCH_VERSION=2.8.0, 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, USE_XCCL=OFF, USE_XPU=OFF,

TorchVision: 0.23.0+cu128
LMDeploy: 0.12.1+
transformers: 4.57.6
fastapi: 0.135.2
pydantic: 2.12.5
triton: 3.4.0
NVIDIA Topology: 
        GPU0    GPU1    GPU2    GPU3    GPU4    GPU5    GPU6    GPU7    NIC0    NIC1    NIC2    NIC3    NIC4    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      NV8     NV8     NV8     NV8     NV8     NV8     NV8     SYS     PIX     NODE    SYS     SYS     0-59    0               N/A
GPU1    NV8      X      NV8     NV8     NV8     NV8     NV8     NV8     SYS     PIX     NODE    SYS     SYS     0-59    0               N/A
GPU2    NV8     NV8      X      NV8     NV8     NV8     NV8     NV8     SYS     NODE    PIX     SYS     SYS     0-59    0               N/A
GPU3    NV8     NV8     NV8      X      NV8     NV8     NV8     NV8     SYS     NODE    PIX     SYS     SYS     0-59    0               N/A
GPU4    NV8     NV8     NV8     NV8      X      NV8     NV8     NV8     SYS     SYS     SYS     PIX     NODE    60-119  1               N/A
GPU5    NV8     NV8     NV8     NV8     NV8      X      NV8     NV8     SYS     SYS     SYS     PIX     NODE    60-119  1               N/A
GPU6    NV8     NV8     NV8     NV8     NV8     NV8      X      NV8     SYS     SYS     SYS     NODE    PIX     60-119  1               N/A
GPU7    NV8     NV8     NV8     NV8     NV8     NV8     NV8      X      SYS     SYS     SYS     NODE    PIX     60-119  1               N/A
NIC0    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS      X      SYS     SYS     SYS     SYS
NIC1    PIX     PIX     NODE    NODE    SYS     SYS     SYS     SYS     SYS      X      NODE    SYS     SYS
NIC2    NODE    NODE    PIX     PIX     SYS     SYS     SYS     SYS     SYS     NODE     X      SYS     SYS
NIC3    SYS     SYS     SYS     SYS     PIX     PIX     NODE    NODE    SYS     SYS     SYS      X      NODE
NIC4    SYS     SYS     SYS     SYS     NODE    NODE    PIX     PIX     SYS     SYS     SYS     NODE     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
  NIC2: mlx5_2
  NIC3: mlx5_3
  NIC4: mlx5_4

`

FangdongWang avatar Mar 30 '26 15:03 FangdongWang

用的是哪个backend呢? 麻烦执行 lmdeploy check_env,贴下环境信息 https://github.com/InternLM/lmdeploy/issues/4479#issuecomment-4155872799

FangdongWang avatar Mar 30 '26 15:03 FangdongWang