sgl-project/sglang · error · ValueError

Unsupported weight strategy={self.strategy}, supported strat

Error message

Unsupported weight strategy={self.strategy}, supported strategies are {SUPPORTED_STRATEGIES}

What it means

create_weights for the W8A16 FP8 scheme only knows how to build weight_scale parameters for CHANNEL and TENSOR strategies. Any other QuantizationStrategy (e.g. BLOCK/grouped) falls through to this ValueError.

Source

Thrown at python/sglang/srt/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a16_fp8.py:106

            output_dim=0,
            weight_loader=weight_loader,
        )
        layer.register_parameter("weight", weight)

        # WEIGHT SCALE
        if self.strategy == QuantizationStrategy.CHANNEL:
            weight_scale = ChannelQuantScaleParameter(
                data=torch.empty((sum(output_partition_sizes), 1), dtype=torch.float32),
                output_dim=0,
                weight_loader=weight_loader,
            )
        elif self.strategy == QuantizationStrategy.TENSOR:
            weight_scale = PerTensorScaleParameter(
                data=torch.empty(len(output_partition_sizes), dtype=torch.float32),
                weight_loader=weight_loader,
            )
        else:
            raise ValueError(
                f"Unsupported weight strategy={self.strategy}, "
                f"supported strategies are {SUPPORTED_STRATEGIES}"
            )

        weight_scale[:] = torch.finfo(torch.float32).min
        layer.register_parameter("weight_scale", weight_scale)

        # INPUT SCALE (to deal with converted checkpoints)
        if self.is_static_input_scheme:
            input_scale = PerTensorScaleParameter(
                data=torch.empty(len(output_partition_sizes), dtype=torch.float32),
                weight_loader=weight_loader,
            )
            layer.register_parameter("input_scale", input_scale)

    def apply_weights(
        self,
        layer: torch.nn.Module,

View on GitHub (pinned to 0132848349)

Solutions

  1. Re-quantize weights as channelwise (strategy: channel) or per-tensor so the W8A16 FP8 path applies
  2. Verify the weights section of quantization_config: strategy should be "channel" or "tensor"
  3. If block-quantized FP8 is intended, use a scheme that supports BLOCK (W8A8 fp8 block path) by also quantizing activations

Example fix

// before
"weights": {"strategy": "block", "group_size": 128}
// after
"weights": {"strategy": "channel"}
Defensive patterns

Strategy: validation

Validate before calling

strategy = cfg["quantization_config"]["weights"]["strategy"]
assert strategy in ("channel", "tensor"), f"W8A16 fp8 unsupported strategy {strategy}"

Type guard

def is_w8a16_compatible(w):
    return w.get("strategy") in {"channel", "tensor"}

Prevention

When it happens

Trigger: A compressed-tensors checkpoint whose weights section declares strategy 'block' (grouped FP8 with a group_size) is routed to CompressedTensorsW8A16Fp8; the strategy is neither CHANNEL nor TENSOR when allocating weight_scale.

Common situations: Quantizing with block-wise FP8 weights but per-token dynamic activations, causing scheme dispatch to the W8A16 path; mismatched quantization recipes between weights and activations.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/5963a147d762cbdc. Report an issue: GitHub.