code: def quantize(models_name_or_path):
      """
      Quantize the weights of the model from float32 to in8 to allow very efficient inference on modern CPU
  
      Uses unsigned ints for activation values, signed ints for weights, per
      https://onnxruntime.ai/docs/performance/quantization.html#data-type-selection
      it is faster on most CPU architectures
      Args:
          onnx_model_path: Path to location the exported ONNX model is stored
      Returns: The Path generated for the quantized
      """
      from onnxruntime.quantization import quantize_dynamic, QuantType
  
      bar = Bar("Quantizing...", max=3)
  
      quant_model_paths = []
      for model in models_name_or_path:
          model_name = model.as_posix()
          output_model_name = f"{model_name[:-5]}-quantized.onnx"
          quantize_dynamic(
              model_input=model_name,
              model_output=output_model_name,
              per_channel=True,
              reduce_range=True,  # should be the same as per_channel
              activation_type=QuantType.QUInt8,
              weight_type=QuantType.QInt8,  # per docs, signed is faster on most CPUs
              optimize_model=False,
          )  # op_types_to_quantize=['MatMul', 'Relu', 'Add', 'Mul' ],
          quant_model_paths.append(output_model_name)
          bar.next()
  
      bar.finish()
  
      return tuple(quant_model_paths)
  
file_path: fastT5/fastT5/onnx_exporter.py
imports: from .huggingface_utils import get_auth_token
  from .onnx_models_structure import T5Encoder, DecoderWithLMhead, DecoderWithLMheadInitial
  from transformers import AutoConfig, T5ForConditionalGeneration, MT5ForConditionalGeneration
  import torch
  import functools
  import operator
  from progress.bar import Bar
  from pathlib import Path
  import os
label_desc: Use image node_id 5 for calling a global function with example usage: quantize(models_name_or_path) and returns: tuple