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

Method forward

inference/modules/fused_attn.py:58–76  ·  view source on GitHub ↗
(
        self,
        query: torch.Tensor,
        key: torch.Tensor,
        positions: torch.Tensor,
    )

Source from the content-addressed store, hash-verified

56 self.register_buffer("cos_sin_cache", cache.half(), persistent=False)
57
58 def forward(
59 self,
60 query: torch.Tensor,
61 key: torch.Tensor,
62 positions: torch.Tensor,
63 ):
64 # Apply rotary embedding to the query and key before passing them
65 # to the attention op.
66 # print(positions.shape, query.shape, key.shape, self.cos_sin_cache.shape)
67 query = query.contiguous()
68 key = key.contiguous()
69 awq_inference_engine.rotary_embedding_neox(
70 positions,
71 query,
72 key,
73 self.dim,
74 self.cos_sin_cache,
75 )
76 return query, key
77
78
79class QuantLlamaAttention(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected