code: def quantize(self, device=None):
      if not self.quantized:
          w = self.data.contiguous().float()
          if self.qtype == MOFQ4:
              if device == "meta":
                  w_quantized = ggml_convert_qtype(
                      w,
                      SYM_INT4,
                      device=device,
                      convert_shape_only=self.convert_shape_only,
                  )
                  # TODO: should load from config, the current implementation doesn't support
                  # save/load
                  self.qtype = SYM_INT4
              else:
                  q4_0_mse, w_quant_q4_0 = self.ggml_mse(
                      w, SYM_INT4, device=device
                  )
                  fp4_mse, w_quant_fp4 = self.ggml_mse(
                      w, FP4, device=device
                  )
                  if q4_0_mse <= fp4_mse:
                      self.qtype = SYM_INT4
                      self.data = w_quant_q4_0
                  else:
                      self.qtype = FP4
                      self.data = w_quant_fp4
          elif self.qtype == MOFQ8:
              if device == "meta":
                  w_quantized = ggml_convert_qtype(
                      w,
                      SYM_INT8,
                      device=device,
                      convert_shape_only=self.convert_shape_only,
                  )
                  # TODO: should load from config, the current implementation doesn't support
                  # save/load
                  self.qtype = SYM_INT8
              else:
                  q8_0_mse, w_quant_q8_0 = self.ggml_mse(
                      w, SYM_INT8, device=device
                  )
                  fp8_mse, w_quant_fp8 = self.ggml_mse(
                      w, FP8E4, device=device
                  )
                  if q8_0_mse <= fp8_mse:
                      self.qtype = SYM_INT8
                      self.data = w_quant_q8_0
                  else:
                      self.qtype = FP8E4
                      self.data = w_quant_fp8
          else:
              w_quantized = ggml_convert_qtype(
                  w,
                  self.qtype,
                  device=device,
                  convert_shape_only=self.convert_shape_only,
              )
              self.data = w_quantized
          self.quantized = True
          self._shape = w.shape
      return self
  
imports: from typing import Optional, TypeVar, Union, overload
  from bigdl.llm.utils.common import invalidInputError
  import os
  import torch
  import torch.nn.functional
  from torch import Tensor, device, dtype, nn
  from operator import mul
  from functools import reduce
  from bigdl.llm.transformers.xpu_customize_fwd import custom_fwd, custom_bwd
  from bigdl.llm.transformers.utils import get_autocast_dtype, get_xpu_device_type, get_ipex_version
  import bigdl.llm.ggml.model.llama.llama_cpp
  import ctypes
  from bigdl.llm.ggml.quantize import ggml_tensor_qtype
label_desc: Use image node_id 3 for calling the FP4Params obj's underlying member method code with example usage: obj.quantize(device) and returns: self