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

Method forward

bitsandbytes/nn/modules.py:966–977  ·  view source on GitHub ↗
(self, input: Tensor)

Source from the content-addressed store, hash-verified

964 raise NotImplementedError("Saving Embedding4bit module is not implemented")
965
966 def forward(self, input: Tensor) -> Tensor:
967 fix_4bit_weight_quant_state_from_module(self)
968
969 if self.embedding_dim % self.weight.quant_state.blocksize == 0:
970 return self._forward_with_partial_dequantize(input)
971
972 dequantized_weight = bnb.functional.dequantize_4bit(self.weight.data, self.weight.quant_state)
973
974 return torch.nn.functional.embedding(
975 weight=dequantized_weight,
976 input=input,
977 ).to(self.dtype)
978
979
980class EmbeddingFP4(Embedding4bit):

Callers

nothing calls this directly

Calls 3

toMethod · 0.45

Tested by

no test coverage detected