vllm.models.glm5next.nvidia.mega_moe
¶
GLM-5.3-Flash adapter for the DeepGEMM MegaMoE kernel.
Classes:
-
Glm5NextMegaMoEExperts–MXFP8 MegaMoE experts loaded from GLM-5.3-Flash's block-FP8 checkpoint.
Glm5NextMegaMoEExperts
¶
Bases: DeepGemmMegaMoEExperts
MXFP8 MegaMoE experts loaded from GLM-5.3-Flash's block-FP8 checkpoint.
The checkpoint stores E4M3 weights with one float32 scale per
weight_block_size block; the kernel takes power-of-two UE8M0 scales per
1x32. Loading writes each weight shard straight into the kernel layout and
stages its block scale in *_weight_scale_inv. Once a load is complete,
the model's process_weights_after_loading calls
:meth:requantize_block_fp8, which rounds every newly loaded shard to the
kernel scales in place. The shared expert is fused the same way.
Methods:
-
load_shared_expert_weight–Load one shared-expert checkpoint tensor; return the parameter name.
-
requantize_block_fp8–Round every shard loaded since the last call to UE8M0 1x32 scales,
Source code in vllm/models/glm5next/nvidia/mega_moe.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
_register_block_scale(name, shape)
¶
Stage the checkpoint's float32 block scales of name. The kernel's
{name}_weight_scale is derived from them and never loaded.
Source code in vllm/models/glm5next/nvidia/mega_moe.py
_requantize_shards(tensors, shard_id)
¶
Requantize shard_id of each kernel-layout weight in place.
Source code in vllm/models/glm5next/nvidia/mega_moe.py
_shard_rows(t, shard_id)
staticmethod
¶
Rows of t (gate rows, then up rows, for w13) that hold shard_id.
Source code in vllm/models/glm5next/nvidia/mega_moe.py
_shard_tensors(local_expert_id, shard_id)
¶
Kernel weight, kernel scale and staged block scale of one routed
expert, or of the shared expert for local_expert_id None.
Source code in vllm/models/glm5next/nvidia/mega_moe.py
load_shared_expert_weight(name, loaded_weight)
¶
Load one shared-expert checkpoint tensor; return the parameter name.
Source code in vllm/models/glm5next/nvidia/mega_moe.py
requantize_block_fp8(chunk=8)
¶
Round every shard loaded since the last call to UE8M0 1x32 scales, in place.
Runs once a load is complete. A weight update may send a weight and its
block scale in separate load_weights calls, but both have to be in
by then.