Skip to content

Commit

Permalink
fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
dsikka committed Oct 13, 2024
1 parent 34fecdb commit 2567660
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/compressed_tensors/quantization/lifecycle/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
calculate_range,
compute_dynamic_scales_and_zp,
)
from compressed_tensors.quantization.lifecycle.initialize import initialize_observers
from compressed_tensors.quantization.quant_args import (
QuantizationArgs,
QuantizationStrategy,
Expand Down Expand Up @@ -279,7 +278,10 @@ def wrapped_forward(self, *args, **kwargs):
if scheme.input_activations is not None:
# calibrate and (fake) quantize input activations when applicable
# NOTE: will be moved out of compressed-tensors
if module.quantization_status == QuantizationStatus.CALIBRATION:
if (
module.quantization_status == QuantizationStatus.CALIBRATION
and not scheme.input_activations.dynamic
):
calibrate_activations(
module=module,
value=input_,
Expand Down Expand Up @@ -307,7 +309,10 @@ def wrapped_forward(self, *args, **kwargs):
# wrap_module_forward_quantized_attn

# NOTE: will be removed from compressed-tensors
if module.quantization_status == QuantizationStatus.CALIBRATION:
if (
module.quantization_status == QuantizationStatus.CALIBRATION
and not scheme.output_activations.dynamic
):
calibrate_activations(
module=module,
value=output,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@


def test_apply_tinyllama_dynamic_activations():
# NOTE: should not calibrate dynamic quant
quant_config = get_sample_dynamic_tinyllama_quant_config()
model = get_tinyllama_model()

Expand Down

0 comments on commit 2567660

Please sign in to comment.