code: def get_quantize_weight_fn(
      quantizer: Quantizer, pre_quant_weight: nn.Parameter
  ) -> Callable:
      def func() -> Tuple[nn.Parameter, Tensor, Tensor]:
          (
              quantized_weights,
              quant_scale,
              quant_min,
          ) = quantizer.quantize(pre_quant_weight.data)
          # A temporary hack as zero Zero3 assume all model weights has the same type. in all_gather_coalesced.get_only_unique_item
          quantized_weights = quantized_weights.view(
              pre_quant_weight.dtype
          )
          quant_scale = quant_scale.type(pre_quant_weight.dtype)
          quant_min = quant_min.type(pre_quant_weight.dtype)
          return quantized_weights, quant_scale, quant_min
  
      return func
  
file_path: DeepSpeed/deepspeed/inference/quantization/layers.py
imports: import torch
  from torch import nn
  from torch import Tensor
  from torch.nn import functional
  from .utils import Quantizer, DeQuantizer, concat_to_compat_param
  from typing import Tuple, Callable, Dict
  from deepspeed.runtime.zero import register_external_parameter
label_desc: Use image node_id 2 for calling a global function with example usage: get_quantize_weight_fn(quantizer, pre_quant_weight) and returns: func, quantized_weights,  quant_scale,  quant_min