MCPcopy Create free account
hub / github.com/DevTechJr/turboquant_cutile / test_single_decode_token

Function test_single_decode_token

tests/test_attention.py:101–112  ·  view source on GitHub ↗

Typical decode scenario: seq_q=1, seq_k=large.

()

Source from the content-addressed store, hash-verified

99
100
101def test_single_decode_token():
102 """Typical decode scenario: seq_q=1, seq_k=large."""
103 engine = TurboQuantEngine(head_dim=128, total_bits=3, device="cpu")
104 Q = torch.randn(1, 128).half()
105 K = torch.randn(2048, 128).half()
106
107 compressed_k = engine.compress_keys_pytorch(K)
108 scores = engine.attention_scores_pytorch(Q, compressed_k)
109
110 assert scores.shape == (1, 2048)
111 assert not torch.isnan(scores).any()
112 assert not torch.isinf(scores).any()
113
114
115def test_needle_in_haystack():

Callers

nothing calls this directly

Calls 3

compress_keys_pytorchMethod · 0.95
TurboQuantEngineClass · 0.90

Tested by

no test coverage detected