MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / forward

Method forward

codegeex/quantization/quantize_oneflow.py:89–101  ·  view source on GitHub ↗
(self, input_)

Source from the content-addressed store, hash-verified

87 self.weight_zero = Parameter(self.weight_zero.to(kwargs["device"]), requires_grad=False)
88
89 def forward(self, input_):
90 # Matrix multiply.
91 output = torch._C.fused_linear_with_groupwise_quantized_weight(input_,
92 w=self.weight,
93 w_scale=self.weight_scale,
94 w_zero=self.weight_zero,
95 b=self.bias if self.bias is not None else None,
96 num_bits=self.weight_bit_width,
97 symmetric=self.symmetric,
98 group_dim=self.group_dim,
99 group_size=self.group_size)
100
101 return output
102
103def quantize_oneflow(model, weight_bit_width):
104 """Replace fp16 linear with quantized linear"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected