MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / __init__

Method __init__

quantization/qlinear.py:51–61  ·  view source on GitHub ↗
(self, input_features, output_features, bias=True, compute_dtype=torch.bfloat16, quant_type="ste-n2f3", q_group_size=128, device=None)

Source from the content-addressed store, hash-verified

49
50class QLinear(nn.Linear):
51 def __init__(self, input_features, output_features, bias=True, compute_dtype=torch.bfloat16, quant_type="ste-n2f3", q_group_size=128, device=None):
52 super().__init__(input_features, output_features, bias, device)
53
54 if quant_type == "ste-n2f3":
55 self.weight_quantizer = SteN2F3Quantizer(q_group_size=q_group_size)
56 elif quant_type == "int2-asym":
57 self.weight_quantizer = SteInt2AsymQuantizer(q_group_size=q_group_size)
58 else:
59 raise ValueError(f"Has no support {quant_type}. Valid quant_type:[ste-n2f3, int2-asym]")
60 # self.quant_type = quant_type
61 self.compute_dtype = compute_dtype
62
63 def forward(self, x: torch.Tensor):
64 if self.bias is not None and self.bias.dtype != x.dtype:

Callers

nothing calls this directly

Calls 2

SteN2F3QuantizerClass · 0.85

Tested by

no test coverage detected