def __init__(
        self,
        model,
        weight_config=None,
        dataloader=None,
        nsamples=128,
        use_max_length=True,
        pad_max_length=2048,
        device=None,
        layer_wise=False,
    ):
        """
        Args:
            model: the fp32 model to quantize
            weight_config (dict, optional): contains all info required by GPTQ. Defaults to {}. For example,
            weight_config={
                'layer1':
                {
                    'bits': 4,
                    'group_size': 32,
                    'sym': False,
                    'percdamp': .01,
                    'act_order': False
                }
                ...
            }
            dataloader: an iterable containing calibration datasets, contains (inputs, targets)
        """
        self.model = model
        self.gptq_related_blocks = trace_gptq_target_blocks(
            self.model
        )  # get the transformer block list above
        self.dtype = next(iter(self.model.parameters())).dtype
        log_quantizable_layers_per_transformer(self.gptq_related_blocks)

        if weight_config is None:
            weight_config = {}
        self.weight_config = weight_config
        # default settings, check configs
        self.wbits_default = 4
        self.group_size_default = 128
        self.block_size_default = 128
        self.percdamp_default = 0.01
        self.sym_default = False
        self.act_order_default = False
        self.static_groups_default = False
        self.true_sequential_default = None
        self.perchannel_default = True
        self.mse_default = False
        self.check_layer_config()
        self.device = "cpu"
        self.is_ready = False
        self.layer_wise = layer_wise

        # dataloader
        self.use_max_length = use_max_length
        self.pad_max_length = pad_max_length or 2048
        self.dataloader_original = dataloader
        self.dataloader = []
        self.nsamples = nsamples
        self.prepare_dataloader()

        Args:
            model: the fp32 model to quantize
            weight_config (dict, optional): contains all info required by GPTQ. Defaults to {}. For example,
            weight_config={
                'layer1':
                {
                    'bits': 4,
                    'group_size': 32,
                    'sym': False,
                    'percdamp': .01,
                    'act_order': False
                }
                ...
            }
            dataloader: an iterable containing calibration datasets, contains (inputs, targets)
        
intel_extension_for_pytorch/quantization/_GPTQ/gptq/gptq.py