vllm.model_executor.layers.quantization.online.shared_expert
¶
Classes:
-
OnlineSharedExpertLoader–Loads the fused shared experts (FSE) of a
RoutedExpertslayer with online
OnlineSharedExpertLoader
¶
Loads the fused shared experts (FSE) of a RoutedExperts layer with online
quantization.
- Staged shared experts: the shared experts are loaded as stored in temporary
slots (
online_w{13,2}_weight[_scale]), dequantized after loading, and quantized into the routed experts slots: with the routed experts when they are requantized, else byfinalize. - Unquantized shared experts with pre-quantized routed experts: the shared
experts are quantized on arrival by
quantizer, and loaded in the routed experts slots.
Methods:
-
create_staging–Create parameters holding the fused shared experts as stored.
-
dequantize_staging–Return the staged
(w13, w2)shared experts, dequantized if needed. -
finalize–Quantize the staged shared experts into the pre-quantized routed experts
-
load–Prepare the load of a fused shared expert tensor in
-
redirect_mapping–Point the expert params mapping of the shared experts to the staging
-
redirect_param_name–Parameter name a checkpoint tensor of expert
expert_idloads into.
_staging_param_name(weight_name, shard_id)
staticmethod
¶
Staging parameter (online_w{13,2}_weight[_scale]) of a shared expert
tensor. They are separate from the routed experts' parameters. None for
other tensors.
create_staging(layer, params_dtype, **extra_weight_attrs)
¶
Create parameters holding the fused shared experts as stored.
The checkpoint shared experts are loaded as stored into
online_w{13,2}_weight (plus online_w{13,2}_weight_scale for
quantized shared experts), which are separate from the routed experts'
parameters. They are dequantized by dequantize_staging.
dequantize_staging(layer)
¶
Return the staged (w13, w2) shared experts, dequantized if needed.
finalize(layer)
¶
Quantize the staged shared experts into the pre-quantized routed experts slots. To call after loading, before the routed experts' processing.
Requantized routed experts quantize the staged shared experts themselves.
load(layer, param, loaded_weight, weight_name, shard_id, global_expert_id, expert_id)
¶
Prepare the load of a fused shared expert tensor in
RoutedExperts.weight_loader.
Returns:
-
Parameter–The parameter and local expert id to load into, and the load result if
-
int–the tensor was already loaded (None to let the caller load it).
redirect_mapping(mapping)
¶
Point the expert params mapping of the shared experts to the staging
parameters, as e.g. w13_ -> online_w13_.
redirect_param_name(param_name, shard_id, expert_id)
¶
Parameter name a checkpoint tensor of expert expert_id loads into.