tracel-ai/burn · error

from_data not supported for scheme {scheme:?}

Error message

from_data not supported for scheme {scheme:?}

What it means

Unsupported-scheme guard in the ndarray backend's `q_from_data`: quantization schemes using low-bit values (Q4F/Q4S/Q2F/Q2S) or float formats (E2M1/E4M3/E5M2) cannot be represented as ndarray quantized tensors, so constructing a quantized tensor from data with such a scheme panics.

Source

Thrown at crates/burn-ndarray/src/ops/qtensor.rs:72

                            qparams,
                            global,
                        }
                    }
                    QuantScheme {
                        value:
                            QuantValue::Q4F
                            | QuantValue::Q4S
                            | QuantValue::Q2F
                            | QuantValue::Q2S
                            | QuantValue::E2M1
                            | QuantValue::E4M3
                            | QuantValue::E5M2,
                        ..
                    }
                    | QuantScheme {
                        mode: QuantMode::Lookup,
                        ..
                    } => unimplemented!("from_data not supported for scheme {scheme:?}"),
                }
            }
            _ => panic!(
                "Invalid dtype (expected DType::QFloat, got {:?})",
                data.dtype
            ),
        }
    }

    fn quantize(
        tensor: FloatTensor<Self>,
        scheme: &QuantScheme,
        qparams: QuantizationParametersPrimitive<Self>,
    ) -> QuantizedTensor<Self> {
        let shape = tensor.shape();
        let data_f = tensor.into_data();
        let scales = qparams.scales.into_data().convert::<f32>();
        // Quantize against the scale that will actually be stored, so a save/load round trip

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Re-quantize the data with a supported scheme (e.g., Q8S/Q8F per-tensor or per-block symmetric)
  2. Use a backend that supports the target scheme (e.g., cubecl-based backends)
  3. Convert the checkpoint to a supported quantization scheme before loading into ndarray
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/burn-ndarray/src/ops/qtensor.rs:72 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05). Data as JSON: /api/errors/384ee041f5d09d30. Report an issue: GitHub.