vllm.model_executor.layers.fused_moe.fused_moe_method_base ¶
FusedMoEMethodBase ¶
Bases: QuantizeMethodBase
Source code in vllm/model_executor/layers/fused_moe/fused_moe_method_base.py
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 | |
skip_forward_padding property ¶
skip_forward_padding: bool
Whether to skip the padding in the forward before applying the moe method.
maybe_roundup_sizes ¶
maybe_roundup_sizes(
hidden_size: int,
intermediate_size_per_partition: int,
act_dtype: dtype,
moe_parallel_config: FusedMoEParallelConfig,
) -> tuple[int, int]
Given layer hidden size and intermediate size per partition and MoE configurations, round up hidden_size and intermediate_size_per_partition if necessary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hidden_size | int | Layer hidden-size | required |
intermediate_size_per_partition | int | Intermediate size per partition for the layer. | required |
act_dtype | dtype | Data type of the layer activations. | required |
moe_parallel_config | FusedMoEParallelConfig | Fused MoE parallelization strategy configuration. | required |
Return
A tuple of (rounded_hidden_size, rounded_intermediate_size_per_partition), where: - rounded_hidden_size is the possibly rounded up hidden size. - rounded_intermediate_size_per_partition is the possibly rounded up intermediate size per partition.
Source code in vllm/model_executor/layers/fused_moe/fused_moe_method_base.py
uses_weight_scale_2_pattern ¶
uses_weight_scale_2_pattern() -> bool
Returns True if this quantization method uses 'weight_scale_2' pattern for per-tensor weight scales (e.g., FP4 variants), False otherwise.
This method should be overridden by subclasses that use the 'weight_scale_2' pattern instead of the standard 'weight_scale' pattern.