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

Method forward

inference/models/falcon.py:70–75  ·  view source on GitHub ↗
(self, _q, _k)

Source from the content-addressed store, hash-verified

68 return self.cos_cached, self.sin_cached
69
70 def forward(self, _q, _k):
71 batch, seq_len, num_heads, head_dim = _q.shape
72 q = _q.permute(0, 2, 1, 3).contiguous().reshape(-1, seq_len, head_dim)
73 k = _k.permute(0, 2, 1, 3).contiguous().reshape(-1, seq_len, head_dim)
74 cos, sin = self.cos_sin(seq_len, q.device, q.dtype)
75 return (q * cos) + (rotate_half(q) * sin), (k * cos) + (rotate_half(k) * sin)
76
77
78class FalconAttentionFused(nn.Module):

Callers

nothing calls this directly

Calls 2

cos_sinMethod · 0.95
rotate_halfFunction · 0.85

Tested by

no test coverage detected