dropp baes64 use binary
This commit is contained in:
@@ -278,6 +278,43 @@ def test_session_is_stable_and_decode_payloads_are_single_token():
|
||||
assert head_backend.released == [session_id]
|
||||
|
||||
|
||||
def test_large_prefill_activation_survives_zstd_compressed_hop():
|
||||
"""A prefill body above _COMPRESS_MIN_BYTES travels the hop zstd-compressed.
|
||||
|
||||
The head compresses and sets X-Meshnet-Encoding; the tail's /forward must
|
||||
decompress before shape validation, so a passing generation proves the
|
||||
compressed round trip (a mishandled encoding fails validation with 400).
|
||||
"""
|
||||
|
||||
class _BigHeadBackend(_CachedHeadBackend):
|
||||
def encode_prompt(self, prompt, session_id=None):
|
||||
self.prefills.append(session_id)
|
||||
if session_id:
|
||||
self._seq[session_id] = 2048
|
||||
return TensorPayload(
|
||||
body=b"\x00" * (1 * 2048 * 32 * 2), # 128 KiB, above the zstd threshold
|
||||
shape=[1, 2048, 32],
|
||||
attention_mask_header=None,
|
||||
position_ids_header=None,
|
||||
)
|
||||
|
||||
head_backend = _BigHeadBackend()
|
||||
tail_backend = _CachedTailBackend([(" a", 1), (" b", 2)])
|
||||
head = TorchNodeServer(backend=head_backend, tracker_mode=True)
|
||||
tail = TorchNodeServer(backend=tail_backend)
|
||||
head_port = head.start()
|
||||
tail_port = tail.start()
|
||||
try:
|
||||
content = _chat_once(head_port, tail_port, max_tokens=2)
|
||||
finally:
|
||||
head.stop()
|
||||
tail.stop()
|
||||
|
||||
assert content == " a b"
|
||||
assert tail_backend.calls[0]["mode"] == "prefill"
|
||||
assert tail_backend.calls[0]["shape"] == [1, 2048, 32]
|
||||
|
||||
|
||||
def test_eos_token_id_stops_generation():
|
||||
head_backend = _CachedHeadBackend()
|
||||
tail_backend = _CachedTailBackend([(" a", 1), ("", 99)])
|
||||
|
||||
Reference in New Issue
Block a user