get_default_qconfig_mapping()Build the default static-PTQ QConfigMapping.
Convenience constructor returning a fresh mapping whose global tier is
get_default_qconfig and whose per-type / per-name tiers are empty. Every
eligible module is therefore quantized with the standard histogram-activation /
per-channel-weight recipe unless you add an override. This is the mapping
lucid.quantization.prepare uses when called without an explicit mapping.
Returns
QConfigMappingA mapping whose global QConfig is the default static-PTQ config and
whose type / name tiers are empty (ready to receive overrides).
Notes
- Add exceptions with
QConfigMapping.set_object_type/QConfigMapping.set_module_name(e.g. map a sensitive head toNone). - For quantization-aware training use
get_default_qat_qconfig_mappinginstead — it installslucid.quantization.FakeQuantizerecipes.
Examples
>>> import lucid.nn as nn
>>> import lucid.quantization as Q
>>> mapping = Q.get_default_qconfig_mapping()
>>> mapping.get_qconfig(nn.Conv2d, "features.0") is not None
True
>>> # Keep the classifier in float while quantizing the rest:
>>> _ = mapping.set_module_name("classifier", None)
>>> mapping.get_qconfig(nn.Linear, "classifier") is None
TrueSee Also
get_default_qconfig—The recipe installed as the global tier.get_default_qat_qconfig_mapping—The QAT counterpart.QConfigMapping—The three-tier resolution object this returns.