def from_weight(
        cls,
        qweight: torch.Tensor,
        scales: torch.Tensor,
        zero_points: torch.Tensor,
        in_features: int,
        out_features: int,
        qconfig=None,
        bias: Optional[torch.Tensor] = None,
        group_size: int = -1,
        g_idx: Optional[torch.Tensor] = None,
        quant_method: QuantMethod = QuantMethod.GPTQ_GEMM,
        dtype: QuantDtype = QuantDtype.INT4,
        **kwargs,
    ):
        r"""Create a weight-only quantized module from weight

        Args:
            qweight (Tensor): tensor in int32 dtype and contains actually int4 data
            scales (Tensor): scales for qweight
            zero_points (Tensor): zero points for qweight
            in_features (int): size of each input sample
            out_features (int): size of each output sample
            qconfig (object): Defining the IPEX quantization recipe for Weight only quantization.
                Default value is ``None``.
            bias (Tensor or None): bias for linear
            group_size: Group size for weight quantization
            g_idx: Indices of groups for each input channel of weight. Generated by
                GPTQ with act-order.
            quant_method (int): Quantization method, such as GPTQ=0, AWQ=1, ...
            dtype (int): quantization data type, INT4=0

        """
        if (
            quant_method in [QuantMethod.GPTQ_GEMM, QuantMethod.AWQ_GEMM]
            and dtype == QuantDtype.INT4
        ):
            return cls.from_int4_weight(
                qweight,
                scales,
                zero_points,
                in_features,
                out_features,
                quant_method,
                qconfig,
                bias,
                group_size,
                g_idx,
            )
        else:
            raise AssertionError(
                "Currently ipex.llm.quantization.IPEXWeightOnlyQuantizedLinear.from_weight() supports 4bits with AWQ or GPTQ."
            )
Create a weight-only quantized module from weight

        Args:
            qweight (Tensor): tensor in int32 dtype and contains actually int4 data
            scales (Tensor): scales for qweight
            zero_points (Tensor): zero points for qweight
            in_features (int): size of each input sample
            out_features (int): size of each output sample
            qconfig (object): Defining the IPEX quantization recipe for Weight only quantization.
                Default value is ``None``.
            bias (Tensor or None): bias for linear
            group_size: Group size for weight quantization
            g_idx: Indices of groups for each input channel of weight. Generated by
                GPTQ with act-order.
            quant_method (int): Quantization method, such as GPTQ=0, AWQ=1, ...
            dtype (int): quantization data type, INT4=0

        
intel_extension_for_pytorch/nn/modules/weight_only_quantization.py