(
self,
query: torch.Tensor,
key: torch.Tensor,
positions: torch.Tensor,
)
| 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 | |
| 79 | class QuantLlamaAttention(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected