code: def quantize_model_scalar(model, model_cfg: DictConfig):
      quant_noise_scalar = (
          getattr(model_cfg, "quant_noise_scalar", 0) or 0
      )
      if quant_noise_scalar > 0:
          # quantize_model edits the model in place
          scalar.quantize_model_(
              model, p=quant_noise_scalar, bits=8, update_step=1000
          )
      return model
  
file_path: fairseq/fairseq/quantization_utils.py
imports: import logging
  from fairseq.modules.quantization import pq, quantization_options, scalar
  from omegaconf import DictConfig
label_desc: Use image node_id 1 for calling a global function with example usage: quantize_model_scalar(model, model_cfg) and returns: model