Skip to content

[Bug]: Calling the load_weights method of the MOE model failed #16842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
lyz22233 opened this issue Apr 18, 2025 · 11 comments
Closed
1 task done

[Bug]: Calling the load_weights method of the MOE model failed #16842

lyz22233 opened this issue Apr 18, 2025 · 11 comments
Labels
bug Something isn't working

Comments

@lyz22233
Copy link

Your current environment

INFO 04-18 12:34:27 [init.py:239] Automatically detected platform cuda.
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.3 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.28.1
Libc version: glibc-2.35

Python version: 3.10.16 (main, Dec 11 2024, 16:24:50) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-125.006-shopee-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.3.107
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA H100 80GB HBM3
MIG 7g.80gb Device 0:

Nvidia driver version: 550.90.07
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.9.0.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.0.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.0.0
/usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.0.0
/usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.0.0
/usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.0.0
/usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.0.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.0.0
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): 192
On-line CPU(s) list: 0-191
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Platinum 8468
CPU family: 6
Model: 143
Thread(s) per core: 2
Core(s) per socket: 48
Socket(s): 2
Stepping: 8
CPU max MHz: 3800.0000
CPU min MHz: 800.0000
BogoMIPS: 4200.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 hwp hwp_act_window hwp_epp hwp_pkg_req 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 avx512_fp16 flush_l1d arch_capabilities
L1d cache: 4.5 MiB (96 instances)
L1i cache: 3 MiB (96 instances)
L2 cache: 192 MiB (96 instances)
L3 cache: 210 MiB (2 instances)
NUMA node(s): 2
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,185,187,189,191
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
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected

Versions of relevant libraries:
[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-nccl-cu12==2.21.5
[pip3] nvidia-nvjitlink-cu12==12.4.127
[pip3] nvidia-nvtx-cu12==12.4.127
[pip3] pyzmq==26.4.0
[pip3] torch==2.6.0
[pip3] torchaudio==2.6.0
[pip3] torchdata==0.11.0
[pip3] torchvision==0.21.0
[pip3] transformers==4.51.3
[pip3] triton==3.2.0
[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-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] pyzmq 26.4.0 pypi_0 pypi
[conda] torch 2.6.0 pypi_0 pypi
[conda] torchaudio 2.6.0 pypi_0 pypi
[conda] torchdata 0.11.0 pypi_0 pypi
[conda] torchvision 0.21.0 pypi_0 pypi
[conda] transformers 4.51.3 pypi_0 pypi
[conda] triton 3.2.0 pypi_0 pypi
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.1.dev48+g007bc20 (git sha: 007bc20
vLLM Build Flags:
CUDA Archs: 5.2 6.0 6.1 7.0 7.2 7.5 8.0 8.6 8.7 9.0+PTX; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0 NIC0 NIC1 NIC2 NIC3 NIC4 NIC5 NIC6 NIC7 NIC8 NIC9 NIC10 NIC11 NIC12 NIC13 NIC14 NIC15 NIC16 NIC17 NIC18 NIC19 NIC20 CPU Affinity NUMA Affinity GPU NUMA ID
GPU0 X SYS SYS NODE NODE NODE NODE NODE NODE NODE NODE NODE NODE SYS SYS SYS SYS SYS SYS SYS SYS PIX 5,7,11,13,15 1 N/A
NIC0 SYS X NODE SYS SYS SYS SYS SYS SYS SYS SYS SYS SYS NODE NODE NODE NODE PIX PIX PIX PIX SYS
NIC1 SYS NODE X SYS SYS SYS SYS SYS SYS SYS SYS SYS SYS PIX PIX PIX PIX NODE NODE NODE NODE SYS
NIC2 NODE SYS SYS X PIX PIX NODE PIX PIX NODE NODE NODE NODE SYS SYS SYS SYS SYS SYS SYS SYS NODE
NIC3 NODE SYS SYS PIX X PIX NODE PIX PIX NODE NODE NODE NODE SYS SYS SYS SYS SYS SYS SYS SYS NODE
NIC4 NODE SYS SYS PIX PIX X NODE PIX PIX NODE NODE NODE NODE SYS SYS SYS SYS SYS SYS SYS SYS NODE
NIC5 NODE SYS SYS NODE NODE NODE X NODE NODE PIX PIX PIX PIX SYS SYS SYS SYS SYS SYS SYS SYS NODE
NIC6 NODE SYS SYS PIX PIX PIX NODE X PIX NODE NODE NODE NODE SYS SYS SYS SYS SYS SYS SYS SYS NODE
NIC7 NODE SYS SYS PIX PIX PIX NODE PIX X NODE NODE NODE NODE SYS SYS SYS SYS SYS SYS SYS SYS NODE
NIC8 NODE SYS SYS NODE NODE NODE PIX NODE NODE X PIX PIX PIX SYS SYS SYS SYS SYS SYS SYS SYS NODE
NIC9 NODE SYS SYS NODE NODE NODE PIX NODE NODE PIX X PIX PIX SYS SYS SYS SYS SYS SYS SYS SYS NODE
NIC10 NODE SYS SYS NODE NODE NODE PIX NODE NODE PIX PIX X PIX SYS SYS SYS SYS SYS SYS SYS SYS NODE
NIC11 NODE SYS SYS NODE NODE NODE PIX NODE NODE PIX PIX PIX X SYS SYS SYS SYS SYS SYS SYS SYS NODE
NIC12 SYS NODE PIX SYS SYS SYS SYS SYS SYS SYS SYS SYS SYS X PIX PIX PIX NODE NODE NODE NODE SYS
NIC13 SYS NODE PIX SYS SYS SYS SYS SYS SYS SYS SYS SYS SYS PIX X PIX PIX NODE NODE NODE NODE SYS
NIC14 SYS NODE PIX SYS SYS SYS SYS SYS SYS SYS SYS SYS SYS PIX PIX X PIX NODE NODE NODE NODE SYS
NIC15 SYS NODE PIX SYS SYS SYS SYS SYS SYS SYS SYS SYS SYS PIX PIX PIX X NODE NODE NODE NODE SYS
NIC16 SYS PIX NODE SYS SYS SYS SYS SYS SYS SYS SYS SYS SYS NODE NODE NODE NODE X PIX PIX PIX SYS
NIC17 SYS PIX NODE SYS SYS SYS SYS SYS SYS SYS SYS SYS SYS NODE NODE NODE NODE PIX X PIX PIX SYS
NIC18 SYS PIX NODE SYS SYS SYS SYS SYS SYS SYS SYS SYS SYS NODE NODE NODE NODE PIX PIX X PIX SYS
NIC19 SYS PIX NODE SYS SYS SYS SYS SYS SYS SYS SYS SYS SYS NODE NODE NODE NODE PIX PIX PIX X SYS
NIC20 PIX SYS SYS NODE NODE NODE NODE NODE NODE NODE NODE NODE NODE SYS SYS SYS SYS SYS SYS 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
NIC12: mlx5_12
NIC13: mlx5_13
NIC14: mlx5_14
NIC15: mlx5_15
NIC16: mlx5_16
NIC17: mlx5_17
NIC18: mlx5_18
NIC19: mlx5_19
NIC20: mlx5_bond_0

NVIDIA_VISIBLE_DEVICES=4:0
CUBLAS_VERSION=12.3.4.1
NVIDIA_REQUIRE_CUDA=cuda>=9.0
CUDA_CACHE_DISABLE=1
TORCH_CUDA_ARCH_LIST=5.2 6.0 6.1 7.0 7.2 7.5 8.0 8.6 8.7 9.0+PTX
NCCL_VERSION=2.19.stable.20231214+cuda12.3
NVIDIA_DRIVER_CAPABILITIES=compute,utility,video
NVIDIA_PRODUCT_NAME=PyTorch
VLLM_USE_PRECOMPILED=1
CUDA_VERSION=12.3.2.001
PYTORCH_VERSION=2.3.0a0+ebedce2
PYTORCH_BUILD_NUMBER=0
CUDNN_VERSION=9.0.0.306
VLLM_TARGET_DEVICE=cuda
PYTORCH_HOME=/opt/pytorch/pytorch
LD_LIBRARY_PATH=/usr/local/lib/python3.10/dist-packages/torch/lib:/usr/local/lib/python3.10/dist-packages/torch_tensorrt/lib:/usr/local/cuda/compat/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
NVIDIA_BUILD_ID=82611821
CUDA_DRIVER_VERSION=545.23.08
PYTORCH_BUILD_VERSION=2.3.0a0+ebedce2
CUDA_HOME=/usr/local/cuda
CUDA_HOME=/usr/local/cuda
CUDA_MODULE_LOADING=LAZY
NVIDIA_REQUIRE_JETPACK_HOST_MOUNTS=
NVIDIA_PYTORCH_VERSION=24.02
TORCH_ALLOW_TF32_CUBLAS_OVERRIDE=1
NCCL_CUMEM_ENABLE=0
TORCHINDUCTOR_COMPILE_THREADS=1

🐛 Describe the bug

Manually calling the load_weights method of the MOE model will result in an error, showing that the "layers.0.mlp.experts.w13_weight" parameter does not have a weights_loader attribute.

I located that it was because the w13_weight and w2_weight parameters were recreated in the "process_weights_after_loading" method, but the attributes were not set as when they were created in "create_weights" method, resulting in the weights_loader attribute not being found when these parameters were reloaded.

layer.w13_weight = torch.nn.Parameter(self._maybe_pad_weight(

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.
@lyz22233 lyz22233 added the bug Something isn't working label Apr 18, 2025
@DarkLight1337
Copy link
Member

Could you provide an example to reproduce the failure? Which model are you using?

@lyz22233
Copy link
Author

We used veRL to train DAPO, and it appeared when we did the first test set test after loading the model.

For the model, you can use Qwen2 MOE, because it also uses FusedMoE.

@DarkLight1337
Copy link
Member

Can you check if reverting #16203 fixes the issue? cc @lengrongfu

@lengrongfu
Copy link
Contributor

We used veRL to train DAPO, and it appeared when we did the first test set test after loading the model.

For the model, you can use Qwen2 MOE, because it also uses FusedMoE.

How should I reproduce your problem?

@lyz22233
Copy link
Author

I think it was caused by this change:#14454

The main change is to modify the process_weights_after_loading method of the vllm/model_executor/layers/fused_moe/layer.py file.

It has newly defined w13_weight and w2_weight, but there is no set_weight_attrs

@lyz22233
Copy link
Author

Image

I have commented out these two lines of code, which can temporarily solve my problem.

@DarkLight1337
Copy link
Member

cc @gshtras

@gshtras
Copy link
Collaborator

gshtras commented Apr 18, 2025

Thanks for the info
cc @charlifu

@charlifu
Copy link
Contributor

charlifu commented Apr 18, 2025

@lyz22233 #16854 Can you try this fix?

@lyz22233
Copy link
Author

Great! I'll test it later.

@charlifu
Copy link
Contributor

@lyz22233 The fix PR has been merged. Pls close this issue if you have verified.

@lyz22233 lyz22233 closed this as completed May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants