MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / forward

Method forward

bitsandbytes/nn/modules.py:1209–1220  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

1207 raise NotImplementedError("Please override the `quantize_weights(self, w, outlier_idx)` function")
1208
1209 def forward(self, x):
1210 if self.outlier_dim is None:
1211 tracer = OutlierTracer.get_instance()
1212 if not tracer.is_initialized():
1213 logger.warning("Please use OutlierTracer.initialize(model) before using the OutlierAwareLinear layer")
1214 outlier_idx = tracer.get_outliers(self.weight)
1215 self.outlier_dim = outlier_idx
1216
1217 if not self.is_quantized:
1218 w = self.quantize_weight(self.weight, self.outlier_dim)
1219 self.weight.data.copy_(w)
1220 self.is_quantized = True

Callers

nothing calls this directly

Calls 4

quantize_weightMethod · 0.95
is_initializedMethod · 0.80
get_outliersMethod · 0.80
get_instanceMethod · 0.45

Tested by

no test coverage detected