Skip to content

QAT with Aimet: Gradient & Training Behavior of param_quantizers min/max under two quant_schemes #4087

@piantou

Description

@piantou

When performing QAT with Aimet, assuming my model consists of conv + BN + Silu, I use the following code:

sim = QuantizationSimModel(model=model,
                           quant_scheme=QuantScheme.post_training_tf_enhanced,
                           dummy_input=dummy_input,
                           default_output_bw=8,
                           default_param_bw=8)

Then I set model.train() and define the optimizer:

optimizer = optim.SGD(
            model.parameters(),
            lr=learning_rate,
            momentum=0.9,
            weight_decay=weight_decay,
        )

(1) After setting quant_scheme=QuantScheme.post_training_tf_enhanced:
model.conv.weight obviously has requires_grad=True and is trainable. But do model.conv.param_quantizers.weight.min and model.conv.param_quantizers.weight.max also have requires_grad=True and are trainable?
(2) If I set quant_scheme=QuantScheme.training_range_learning_with_tf_init, what will the requires_grad status of model.conv.param_quantizers.weight.min andmodel.conv.param_quantizers.weight.maxbe?

What is the actual difference in the parameters being updated during QAT training between these two different quant_scheme settings?

Metadata

Metadata

Assignees

No one assigned

    Labels

    aimet-torchNew feature or bug fix for AIMET PyTorchquestionQuestion for AIMET team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions