Skip to content

Commit

Permalink
Feat (ONNX Export): move dynamic quantizers and add example for expor…
Browse files Browse the repository at this point in the history
…t to ONNX
  • Loading branch information
fabianandresgrob committed Feb 26, 2024
1 parent 6079b12 commit 1c8d328
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 49 deletions.
250 changes: 212 additions & 38 deletions notebooks/ONNX_export_tutorial.ipynb

Large diffs are not rendered by default.

File renamed without changes.
21 changes: 11 additions & 10 deletions src/brevitas_examples/common/generative/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
from brevitas.quant.fixed_point import Int8WeightPerChannelFixedPointMSE
from brevitas.quant.fixed_point import Int8WeightPerTensorFixedPoint
from brevitas.quant.fixed_point import Int8WeightPerTensorFixedPointMSE
from brevitas.quant.generative.quantizers import Fp8e4m3WeightSymmetricGroupQuant
from brevitas.quant.generative.quantizers import Int8DynamicActPerGroupFloat
from brevitas.quant.generative.quantizers import Int8DynamicActPerRowFloat
from brevitas.quant.generative.quantizers import Int8DynamicActPerTensorFloat
from brevitas.quant.generative.quantizers import IntWeightSymmetricGroupQuant
from brevitas.quant.generative.quantizers import ShiftedUint8DynamicActPerRowFloat
from brevitas.quant.generative.quantizers import ShiftedUint8DynamicActPerTensorFloat
from brevitas.quant.generative.quantizers import ShiftedUintWeightAsymmetricGroupQuant
from brevitas.quant.scaled_int import Int8ActPerTensorFloat
from brevitas.quant.scaled_int import Int8ActPerTensorFloatMSE
from brevitas.quant.scaled_int import Int8WeightPerChannelFloat
Expand All @@ -31,16 +39,9 @@
from brevitas.quant.shifted_scaled_int import ShiftedUint8WeightPerChannelFloatMSE
from brevitas.quant.shifted_scaled_int import ShiftedUint8WeightPerTensorFloat
from brevitas.quant.shifted_scaled_int import ShiftedUint8WeightPerTensorFloatMSE
from brevitas_examples.common.generative.nn import LoRACompatibleQuantConv2d
from brevitas_examples.common.generative.nn import LoRACompatibleQuantLinear
from brevitas_examples.common.generative.quantizers import Fp8e4m3WeightSymmetricGroupQuant
from brevitas_examples.common.generative.quantizers import Int8DynamicActPerGroupFloat
from brevitas_examples.common.generative.quantizers import Int8DynamicActPerRowFloat
from brevitas_examples.common.generative.quantizers import Int8DynamicActPerTensorFloat
from brevitas_examples.common.generative.quantizers import IntWeightSymmetricGroupQuant
from brevitas_examples.common.generative.quantizers import ShiftedUint8DynamicActPerRowFloat
from brevitas_examples.common.generative.quantizers import ShiftedUint8DynamicActPerTensorFloat
from brevitas_examples.common.generative.quantizers import ShiftedUintWeightAsymmetricGroupQuant

from .nn import LoRACompatibleQuantConv2d
from .nn import LoRACompatibleQuantLinear

WEIGHT_QUANT_MAP = {
'int': {
Expand Down
2 changes: 1 addition & 1 deletion tests/brevitas_ort/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from brevitas.quant.fixed_point import Int8ActPerTensorFixedPoint
from brevitas.quant.fixed_point import Int8WeightPerChannelFixedPoint
from brevitas.quant.fixed_point import Int8WeightPerTensorFixedPoint
from brevitas.quant.generative.quantizers import ShiftedUint8DynamicActPerTensorFloat
from brevitas.quant.scaled_int import Int8AccumulatorAwareWeightQuant
from brevitas.quant.scaled_int import Int8ActPerTensorFloat
from brevitas.quant.scaled_int import Int8WeightPerChannelFloat
Expand All @@ -28,7 +29,6 @@
from brevitas.quant.shifted_scaled_int import ShiftedUint8WeightPerChannelFloat
from brevitas.quant.shifted_scaled_int import ShiftedUint8WeightPerTensorFloat
from brevitas.quant_tensor import QuantTensor
from brevitas_examples.common.generative.quantizers import ShiftedUint8DynamicActPerTensorFloat

SEED = 123456
OUT_CH = 16
Expand Down

0 comments on commit 1c8d328

Please sign in to comment.