code: def fake_quantize():
      config_list = [
          {
              "op_types": ["Linear"],
              "op_names_re": [
                  "bert.encoder.layer.{}".format(i) for i in range(12)
              ],
              "target_names": ["weight", "_output_"],
              "quant_dtype": "int8",
              "quant_scheme": "symmetric",
              "granularity": "default",
          }
      ]
  
      # create a finetune model
      Path("./output/bert_finetuned/").mkdir(
          parents=True, exist_ok=True
      )
      model: torch.nn.Module = build_finetuning_model(f"./output/{task_name}.bin", is_quant=False)  # type: ignore
      traced_trainer = prepare_traced_trainer(model, is_quant=False)
      evaluator = TransformersEvaluator(traced_trainer)
      if quant_method == "lsq":
          quantizer = LsqQuantizer(model, config_list, evaluator)
          model, calibration_config = quantizer.compress(
              max_steps=None, max_epochs=quant_max_epochs
          )
      elif quant_method == "qat":
          quantizer = QATQuantizer(model, config_list, evaluator, 10)
          model, calibration_config = quantizer.compress(
              max_steps=None, max_epochs=quant_max_epochs
          )
      elif quant_method == "ptq":
          quantizer = PtqQuantizer(model, config_list, evaluator)
          model, calibration_config = quantizer.compress(
              max_steps=1, max_epochs=None
          )
      else:
          raise ValueError(
              f"quantization method {quant_method} is not supported"
          )
      print(calibration_config)
      # evaluate the performance of the fake quantize model
      quantizer.evaluator.bind_model(
          model, quantizer._get_param_names_map()
      )
  
imports: from pathlib import Path
  import argparse
  import sys
  import numpy
  import torch
  from torch.utils.data import ConcatDataset
  import nni
  from datasets import load_dataset, load_metric
  from transformers import BertTokenizerFast, DataCollatorWithPadding, BertForSequenceClassification, EvalPrediction
  from transformers.trainer import Trainer
  from transformers.training_args import TrainingArguments
  import nni
  from nni.compression.quantization import QATQuantizer, LsqQuantizer, PtqQuantizer
  from nni.compression.utils import TransformersEvaluator
label_desc: Use image node_id 5 for calling a global function with example usage: fake_quantize() without return types