Skip to content

Instantly share code, notes, and snippets.

@Greg-Tarr
Greg-Tarr / kv_cache_transformer.py
Created January 17, 2025 21:23
Simple transformer KV cache in PyTorch
# /// script
# dependencies = [
# "torch>=2.5.1",
# ]
# ///
# type: ignore
"""
Basic KV cache implementation for a transformer in pytorch.