class_docstr: Handles the ONNX Runtime quantization process for models shared on huggingface.co/models.
class_docstr_tok: ["Handles","the","ONNX","Runtime","quantization","process","for","models","shared","on","huggingface.co\/models","."]
docstr: Performs the calibration step and computes the quantization ranges.
  
  Args:
      dataset (`Dataset`):
          The dataset to use when performing the calibration step.
      calibration_config ([`~CalibrationConfig`]):
          The configuration containing the parameters related to the calibration step.
      onnx_augmented_model_name (`Union[str, Path]`, defaults to `"augmented_model.onnx"`):
          The path used to save the augmented model used to collect the quantization ranges.
      operators_to_quantize (`Optional[List[str]]`, defaults to `None`):
          List of the operators types to quantize.
      batch_size (`int`, defaults to 1):
          The batch size to use when collecting the quantization ranges values.
      use_external_data_format (`bool`, defaults to `False`):
          Whether to use external data format to store model which size is >= 2Gb.
      use_gpu (`bool`, defaults to `False`):
          Whether to use the GPU when collecting the quantization ranges values.
      force_symmetric_range (`bool`, defaults to `False`):
          Whether to make the quantization ranges symmetric.
  
  Returns:
      The dictionary mapping the nodes name to their quantization ranges.
docstr_tok: ["Performs","the","calibration","step","and","computes","the","quantization","ranges",".","Args",":","dataset","(","`","Dataset","`",")",":","The","dataset","to","use","when","performing","the","calibration","step",".","calibration_config","(","[","`","~CalibrationConfig","`","]",")",":","The","configuration","containing","the","parameters","related","to","the","calibration","step",".","onnx_augmented_model_name","(","`","Union","[","str",",","Path","]","`",",","defaults","to","`","``","augmented_model.onnx","''","`",")",":","The","path","used","to","save","the","augmented","model","used","to","collect","the","quantization","ranges",".","operators_to_quantize","(","`","Optional","[","List","[","str","]","]","`",",","defaults","to","`","None","`",")",":","List","of","the","operators","types","to","quantize",".","batch_size","(","`","int","`",",","defaults","to","1",")",":","The","batch","size","to","use","when","collecting","the","quantization","ranges","values",".","use_external_data_format","(","`","bool","`",",","defaults","to","`","False","`",")",":","Whether","to","use","external","data","format","to","store","model","which","size","is",">","=","2Gb",".","use_gpu","(","`","bool","`",",","defaults","to","`","False","`",")",":","Whether","to","use","the","GPU","when","collecting","the","quantization","ranges","values",".","force_symmetric_range","(","`","bool","`",",","defaults","to","`","False","`",")",":","Whether","to","make","the","quantization","ranges","symmetric",".","Returns",":","The","dictionary","mapping","the","nodes","name","to","their","quantization","ranges","."]
code: def fit(
      self,
      dataset: Dataset,
      calibration_config: CalibrationConfig,
      onnx_augmented_model_name: Union[
          str, Path
      ] = "augmented_model.onnx",
      operators_to_quantize: Optional[List[str]] = None,
      batch_size: int = 1,
      use_external_data_format: bool = False,
      use_gpu: bool = False,
      force_symmetric_range: bool = False,
  ) -> Dict[str, Tuple[float, float]]:
      """
      Performs the calibration step and computes the quantization ranges.
  
      Args:
          dataset (`Dataset`):
              The dataset to use when performing the calibration step.
          calibration_config ([`~CalibrationConfig`]):
              The configuration containing the parameters related to the calibration step.
          onnx_augmented_model_name (`Union[str, Path]`, defaults to `"augmented_model.onnx"`):
              The path used to save the augmented model used to collect the quantization ranges.
          operators_to_quantize (`Optional[List[str]]`, defaults to `None`):
              List of the operators types to quantize.
          batch_size (`int`, defaults to 1):
              The batch size to use when collecting the quantization ranges values.
          use_external_data_format (`bool`, defaults to `False`):
              Whether to use external data format to store model which size is >= 2Gb.
          use_gpu (`bool`, defaults to `False`):
              Whether to use the GPU when collecting the quantization ranges values.
          force_symmetric_range (`bool`, defaults to `False`):
              Whether to make the quantization ranges symmetric.
  
      Returns:
          The dictionary mapping the nodes name to their quantization ranges.
      """
      # If a dataset is provided, then we are in a static quantization mode
      LOGGER.info(
          f"Using static quantization schema ("
          f"dataset: {calibration_config.dataset_name}, method: {calibration_config.method}"
          f")"
      )
  
      self.partial_fit(
          dataset,
          calibration_config,
          onnx_augmented_model_name,
          operators_to_quantize,
          batch_size,
          use_external_data_format,
          use_gpu,
          force_symmetric_range,
      )
      return self.compute_ranges()
  
imports: import logging
  import os
  from collections import defaultdict
  from pathlib import Path
  from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Tuple, Union
  import onnx
  from datasets import Dataset, load_dataset
  from packaging.version import Version, parse
  from transformers import AutoConfig
  from onnxruntime import __version__
  from onnxruntime.quantization import CalibrationDataReader, QuantFormat, QuantizationMode, QuantType
  from onnxruntime.quantization.onnx_quantizer import ONNXQuantizer
  from onnxruntime.quantization.qdq_quantizer import QDQQuantizer
  from ..quantization_base import OptimumQuantizer
  from ..utils.save_utils import maybe_save_preprocessors
  from .None import ORTQuantizableOperator
  from .configuration import CalibrationConfig, ORTConfig, QuantizationConfig
  from .modeling_ort import ORTModel
  from .modeling_seq2seq import ORTModelForConditionalGeneration
  from .preprocessors import QuantizationPreprocessor
label_desc: Use image node_id 3 for calling the ORTQuantizer obj's underlying member method code with example usage: obj.fit(dataset, calibration_config, onnx_augmented_model_name, operators_to_quantize, batch_size, use_external_data_format, use_gpu, force_symmetric_range) and returns: self