MCPcopy Create free account
hub / github.com/microsoft/BitNet / forward_with_attn_bias

Method forward_with_attn_bias

gpu/model.py:269–281  ·  view source on GitHub ↗
(
        self,
        token_values: torch.Tensor,
        attn_bias: AttnBias,
        cache: list[LayerCache],
    )

Source from the content-addressed store, hash-verified

267
268 @torch.no_grad()
269 def forward_with_attn_bias(
270 self,
271 token_values: torch.Tensor,
272 attn_bias: AttnBias,
273 cache: list[LayerCache],
274 ) -> torch.Tensor:
275 h = self.tok_embeddings(token_values)
276
277 for i, layer in enumerate(self.layers):
278 h = layer(h, cache[i], attn_bias)
279
280 logits = self.output(self.norm(h))
281 return logits.float()
282
283 def forward(
284 self,

Callers 3

forwardMethod · 0.95
compile_prefillMethod · 0.80
compile_generateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected