vllm: [Bug]: Gemma-3 (27B) can't load save_pretrained() checkpoint: AssertionError: expected size 5376==2560, stride 1==1 at dim=0

Your current environment

The output of `python collect_env.py`
Collecting environment information...
PyTorch version: 2.6.0+cu124
Is debug build: False
CUDA used to build PyTorch: 12.4
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.22.1
Libc version: glibc-2.35

Python version: 3.10.0 (default, Mar  3 2022, 09:58:08) [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.15.0-112-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.4.131
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: NVIDIA H100 80GB HBM3
GPU 1: NVIDIA H100 80GB HBM3
GPU 2: NVIDIA H100 80GB HBM3
GPU 3: NVIDIA H100 80GB HBM3
GPU 4: NVIDIA H100 80GB HBM3
GPU 5: NVIDIA H100 80GB HBM3
GPU 6: NVIDIA H100 80GB HBM3
GPU 7: NVIDIA H100 80GB HBM3

Nvidia driver version: 550.90.07
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      46 bits physical, 57 bits virtual
Byte Order:                         Little Endian
CPU(s):                             104
On-line CPU(s) list:                0-103
Vendor ID:                          GenuineIntel
Model name:                         Intel(R) Xeon(R) Platinum 8470
CPU family:                         6
Model:                              143
Thread(s) per core:                 1
Core(s) per socket:                 52
Socket(s):                          2
Stepping:                           8
BogoMIPS:                           4000.00
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities
L1d cache:                          4.9 MiB (104 instances)
L1i cache:                          3.3 MiB (104 instances)
L2 cache:                           208 MiB (104 instances)
L3 cache:                           210 MiB (2 instances)
NUMA node(s):                       8
NUMA node0 CPU(s):                  0-12
NUMA node1 CPU(s):                  13-25
NUMA node2 CPU(s):                  26-38
NUMA node3 CPU(s):                  39-51
NUMA node4 CPU(s):                  52-64
NUMA node5 CPU(s):                  65-77
NUMA node6 CPU(s):                  78-90
NUMA node7 CPU(s):                  91-103
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit:        Not affected
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Not affected
Vulnerability Retbleed:             Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Enhanced IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected

Versions of relevant libraries:
[pip3] flashinfer-python==0.2.3+cu124torch2.6
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.4.5.8
[pip3] nvidia-cuda-cupti-cu12==12.4.127
[pip3] nvidia-cuda-nvrtc-cu12==12.4.127
[pip3] nvidia-cuda-runtime-cu12==12.4.127
[pip3] nvidia-cudnn-cu12==9.1.0.70
[pip3] nvidia-cufft-cu12==11.2.1.3
[pip3] nvidia-curand-cu12==10.3.5.147
[pip3] nvidia-cusolver-cu12==11.6.1.9
[pip3] nvidia-cusparse-cu12==12.3.1.170
[pip3] nvidia-cusparselt-cu12==0.6.2
[pip3] nvidia-ml-py==12.570.86
[pip3] nvidia-nccl-cu12==2.21.5
[pip3] nvidia-nvjitlink-cu12==12.4.127
[pip3] nvidia-nvtx-cu12==12.4.127
[pip3] pynvml==12.0.0
[pip3] pytorch-memlab==0.3.0
[pip3] pyzmq==26.3.0
[pip3] torch==2.6.0
[pip3] torchaudio==2.6.0
[pip3] torchvision==0.21.0
[pip3] transformers==4.50.0.dev0
[pip3] triton==3.2.0
[conda] flashinfer-python         0.2.3+cu124torch2.6          pypi_0    pypi
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] nvidia-cublas-cu12        12.4.5.8                 pypi_0    pypi
[conda] nvidia-cuda-cupti-cu12    12.4.127                 pypi_0    pypi
[conda] nvidia-cuda-nvrtc-cu12    12.4.127                 pypi_0    pypi
[conda] nvidia-cuda-runtime-cu12  12.4.127                 pypi_0    pypi
[conda] nvidia-cudnn-cu12         9.1.0.70                 pypi_0    pypi
[conda] nvidia-cufft-cu12         11.2.1.3                 pypi_0    pypi
[conda] nvidia-curand-cu12        10.3.5.147               pypi_0    pypi
[conda] nvidia-cusolver-cu12      11.6.1.9                 pypi_0    pypi
[conda] nvidia-cusparse-cu12      12.3.1.170               pypi_0    pypi
[conda] nvidia-cusparselt-cu12    0.6.2                    pypi_0    pypi
[conda] nvidia-ml-py              12.570.86                pypi_0    pypi
[conda] nvidia-nccl-cu12          2.21.5                   pypi_0    pypi
[conda] nvidia-nvjitlink-cu12     12.4.127                 pypi_0    pypi
[conda] nvidia-nvtx-cu12          12.4.127                 pypi_0    pypi
[conda] pynvml                    12.0.0                   pypi_0    pypi
[conda] pytorch-memlab            0.3.0                    pypi_0    pypi
[conda] pyzmq                     26.3.0                   pypi_0    pypi
[conda] torch                     2.6.0                    pypi_0    pypi
[conda] torchaudio                2.6.0                    pypi_0    pypi
[conda] torchvision               0.21.0                   pypi_0    pypi
[conda] transformers              4.50.0.dev0              pypi_0    pypi
[conda] triton                    3.2.0                    pypi_0    pypi
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.8.2.dev78+g6ebaf9ac
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    GPU1    GPU2    GPU3    GPU4    GPU5    GPU6    GPU7    NIC0    NIC1    NIC2    NIC3    NIC4    NIC5    NIC6    NIC7    NIC8       NIC9    NIC10   NIC11   CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      NV18    NV18    NV18    NV18    NV18    NV18    NV18    PIX     PIX     PIX     SYS     SYS     SYS     SYS     SYSSYS     SYS     SYS     SYS     0-12    0               N/A
GPU1    NV18     X      NV18    NV18    NV18    NV18    NV18    NV18    SYS     SYS     SYS     PIX     SYS     SYS     SYS     SYSSYS     SYS     SYS     SYS     26-38   2               N/A
GPU2    NV18    NV18     X      NV18    NV18    NV18    NV18    NV18    SYS     SYS     SYS     SYS     PIX     SYS     SYS     SYSSYS     SYS     SYS     SYS     39-51   3               N/A
GPU3    NV18    NV18    NV18     X      NV18    NV18    NV18    NV18    SYS     SYS     SYS     SYS     SYS     PIX     SYS     SYSSYS     SYS     SYS     SYS     13-25   1               N/A
GPU4    NV18    NV18    NV18    NV18     X      NV18    NV18    NV18    SYS     SYS     SYS     SYS     SYS     SYS     PIX     PIXPIX     SYS     SYS     SYS     52-64   4               N/A
GPU5    NV18    NV18    NV18    NV18    NV18     X      NV18    NV18    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYSSYS     PIX     SYS     SYS     78-90   6               N/A
GPU6    NV18    NV18    NV18    NV18    NV18    NV18     X      NV18    SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYSSYS     SYS     PIX     SYS     91-103  7               N/A
GPU7    NV18    NV18    NV18    NV18    NV18    NV18    NV18     X      SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYSSYS     SYS     SYS     PIX     65-77   5               N/A
NIC0    PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS      X      PIX     PIX     SYS     SYS     SYS     SYS     SYSSYS     SYS     SYS     SYS
NIC1    PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS     PIX      X      PIX     SYS     SYS     SYS     SYS     SYSSYS     SYS     SYS     SYS
NIC2    PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS     PIX     PIX      X      SYS     SYS     SYS     SYS     SYSSYS     SYS     SYS     SYS
NIC3    SYS     PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS      X      SYS     SYS     SYS     SYSSYS     SYS     SYS     SYS
NIC4    SYS     SYS     PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS      X      SYS     SYS     SYSSYS     SYS     SYS     SYS
NIC5    SYS     SYS     SYS     PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS      X      SYS     SYSSYS     SYS     SYS     SYS
NIC6    SYS     SYS     SYS     SYS     PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS      X      PIXPIX     SYS     SYS     SYS
NIC7    SYS     SYS     SYS     SYS     PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     PIX      X PIX     SYS     SYS     SYS
NIC8    SYS     SYS     SYS     SYS     PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     PIX     PIX X      SYS     SYS     SYS
NIC9    SYS     SYS     SYS     SYS     SYS     PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYSSYS      X      SYS     SYS
NIC10   SYS     SYS     SYS     SYS     SYS     SYS     PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYSSYS     SYS      X      SYS
NIC11   SYS     SYS     SYS     SYS     SYS     SYS     SYS     PIX     SYS     SYS     SYS     SYS     SYS     SYS     SYS     SYSSYS     SYS     SYS      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
  NIC5: mlx5_5
  NIC6: mlx5_6
  NIC7: mlx5_7
  NIC8: mlx5_8
  NIC9: mlx5_9
  NIC10: mlx5_10
  NIC11: mlx5_11

NCCL_CUMEM_ENABLE=0
TORCHINDUCTOR_COMPILE_THREADS=1
CUDA_MODULE_LOADING=LAZY

🐛 Describe the bug

Reproduction code:

import os
import torch
from vllm import LLM
from transformers import AutoTokenizer, AutoProcessor, Gemma3ForConditionalGeneration

model_id = "google/gemma-3-27b-it"
save_path = "<path>"

model = Gemma3ForConditionalGeneration.from_pretrained(
        model_id,
        torch_dtype=torch.bfloat16,
        device_map="cpu"
    )
tokenizer = AutoTokenizer.from_pretrained(model_id)
processor = AutoProcessor.from_pretrained(model_id)

if os.path.exists(save_path):
    import shutil
    shutil.rmtree(save_path)
model.save_pretrained(save_path)
tokenizer.save_pretrained(save_path)
processor.save_pretrained(save_path)

model = LLM(
    model=save_path,
    max_model_len=10240,
    tensor_parallel_size=8,
    limit_mm_per_prompt={"image": 5},
)

====

Error within LLM():

(VllmWorker rank=0 pid=75437) ERROR 03-31 15:54:20 [multiproc_executor.py:379] File “/home/agi/vllm/vllm/compilation/backends.py”, line 607, in call (VllmWorker rank=0 pid=75437) ERROR 03-31 15:54:20 [multiproc_executor.py:379] return self.compiled_graph_for_general_shape(*args) (VllmWorker rank=0 pid=75437) ERROR 03-31 15:54:20 [multiproc_executor.py:379] File “/home/agi/vllm/vllm/compilation/compiler_interface.py”, line 331, in compiled_graph (VllmWorker rank=0 pid=75437) ERROR 03-31 15:54:20 [multiproc_executor.py:379] graph_output = inductor_compiled_graph(list_args) (VllmWorker rank=0 pid=75437) ERROR 03-31 15:54:20 [multiproc_executor.py:379] File “/home/agi/miniconda3/envs/pae/lib/python3.10/site-packages/torch/_inductor/output_code.py”, line 466, in call (VllmWorker rank=0 pid=75437) ERROR 03-31 15:54:20 [multiproc_executor.py:379] return self.current_callable(inputs) (VllmWorker rank=0 pid=75437) ERROR 03-31 15:54:20 [multiproc_executor.py:379] File “/home/agi/.cache/vllm/torch_compile_cache/78ef133a17/rank_0_0/inductor_cache/yv/cyvxdrutb7x6ertpxfu6huibm7tvzukiy3ojusofdbdrmsybotwx.py”, line 357, in call (VllmWorker rank=0 pid=75437) ERROR 03-31 15:54:20 [multiproc_executor.py:379] assert_size_stride(arg0_1, (2560, ), (1, )) (VllmWorker rank=0 pid=75437) ERROR 03-31 15:54:20 [multiproc_executor.py:379] AssertionError: expected size 5376==2560, stride 1==1 at dim=0 ERROR 03-31 15:54:20 [core.py:343] EngineCore hit an exception: Traceback (most recent call last): ERROR 03-31 15:54:20 [core.py:343] File “/home/agi/vllm/vllm/v1/engine/core.py”, line 335, in run_engine_core ERROR 03-31 15:54:20 [core.py:343] engine_core = EngineCoreProc(*args, **kwargs) ERROR 03-31 15:54:20 [core.py:343] File “/home/agi/vllm/vllm/v1/engine/core.py”, line 290, in init ERROR 03-31 15:54:20 [core.py:343] super().init(vllm_config, executor_class, log_stats) ERROR 03-31 15:54:20 [core.py:343] File “/home/agi/vllm/vllm/v1/engine/core.py”, line 63, in init ERROR 03-31 15:54:20 [core.py:343] num_gpu_blocks, num_cpu_blocks = self._initialize_kv_caches( ERROR 03-31 15:54:20 [core.py:343] File “/home/agi/vllm/vllm/v1/engine/core.py”, line 122, in _initialize_kv_caches ERROR 03-31 15:54:20 [core.py:343] available_gpu_memory = self.model_executor.determine_available_memory() ERROR 03-31 15:54:20 [core.py:343] File “/home/agi/vllm/vllm/v1/executor/abstract.py”, line 66, in determine_available_memory ERROR 03-31 15:54:20 [core.py:343] output = self.collective_rpc(“determine_available_memory”) ERROR 03-31 15:54:20 [core.py:343] File “/home/agi/vllm/vllm/v1/executor/multiproc_executor.py”, line 134, in collective_rpc ERROR 03-31 15:54:20 [core.py:343] raise e ERROR 03-31 15:54:20 [core.py:343] File “/home/agi/vllm/vllm/v1/executor/multiproc_executor.py”, line 123, in collective_rpc ERROR 03-31 15:54:20 [core.py:343] raise result ERROR 03-31 15:54:20 [core.py:343] AssertionError: expected size 5376==2560, stride 1==1 at dim=0 ERROR 03-31 15:54:20 [core.py:343] CRITICAL 03-31 15:54:20 [core_client.py:269] Got fatal signal from worker processes, shutting down. See stack trace above for root cause issue.

=====

Behaviors:

  1. The saved model can be loaded with HF from_pretrained().
  2. This error happens for 27B gemma3, but 4B gemma3 works well.
  3. vllm can load original “google/gemma-3-27b-it”, this error only occurs after saving the model.
  4. This error only happens to the V1 engine.

=====

@DarkLight1337 this might interest you

Before submitting a new issue…

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 17 (6 by maintainers)

Most upvoted comments

I reduced my TP size to 2 but I also cannot run the reproducer with the 12B model. My error contains even less information though… No error at all, just CRITICAL logs from the MultiprocExecutor:

CRITICAL 04-01 13:26:14 [multiproc_executor.py:49] MulitprocExecutor got fatal signal from worker processes, shutting down. See stack trace above for root cause issue.
CRITICAL 04-01 13:26:14 [core_client.py:343] Got fatal signal from worker processes, shutting down. See stack trace above for root cause issue.
Killed