Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Zefan-Cai/KVCache-Factory
/ types & classes
Types & classes
47 in github.com/Zefan-Cai/KVCache-Factory
⨍
Functions
410
◇
Types & classes
47
↓ 6 callers
Class
SnapKVCluster
pyramidkv/pyramidkv_utils.py:472
↓ 5 callers
Class
DynamicCache
A cache that grows dynamically as more tokens are generated. This is the default for generative models. It stores the Key and Value states a
pyramidkv/cache_utils_think.py:296
↓ 5 callers
Class
PyramidKVCluster
pyramidkv/pyramidkv_utils.py:323
↓ 3 callers
Class
CAMKVCluster
pyramidkv/pyramidkv_utils.py:652
↓ 3 callers
Class
H2OKVCluster
pyramidkv/pyramidkv_utils.py:797
↓ 3 callers
Class
L2NormCluster
pyramidkv/pyramidkv_utils.py:606
↓ 3 callers
Class
StreamingLLMKVCluster
pyramidkv/pyramidkv_utils.py:893
↓ 3 callers
Class
_FakeCache
Minimal stand-in for a transformers Cache exposing ``key_cache``.
tests/test_generation_state.py:6
↓ 2 callers
Class
_FakeLayer
tests/test_generation_state.py:13
↓ 1 callers
Class
AdaKVCluster
adapt from https://github.com/FFY0/AdaKV.
pyramidkv/pyramidkv_utils.py:945
↓ 1 callers
Class
EncoderDecoderCache
Base, abstract class for all encoder-decoder caches. Can be used to hold combinations of self-attention and cross-attention caches. Exam
pyramidkv/cache_utils_think.py:1269
↓ 1 callers
Class
HeadKVCluster
adapt from https://github.com/FFY0/AdaKV.
pyramidkv/pyramidkv_utils.py:1094
↓ 1 callers
Class
LLMNeedleHaystackTester
This class is used to test the LLM Needle Haystack.
run_needle_in_haystack.py:33
Class
AdaKVKvHeadInvariantsTest
kv_head mode: unrepeated K/V at KV_HEADS, query at Q_HEADS.
tests/test_adakv_headkv_kv_head.py:174
Class
BitIdentityTest
tests/test_query_head_bitident.py:76
Class
BitIdentityTest
Old-vs-new torch.equal on outputs AND metadata in the legacy shapes.
tests/test_adakv_headkv_kv_head.py:128
Class
Cache
Base, abstract class for all caches. The actual data structure is specific to each subclass.
pyramidkv/cache_utils_think.py:26
Class
CacheConfig
Base class for cache configs
pyramidkv/cache_utils_think.py:101
Class
DecodeMetadataSimulationTest
Pure-torch simulation of the per-step decode metadata mutation done by the model forwards (klen_sum += num_cached_heads, max_seqlen_k += 1, cu
tests/test_adakv_headkv_kv_head.py:356
Class
DynamicCacheSplitHeadFlatten
adapt from https://github.com/FFY0/AdaKV.
pyramidkv/pyramidkv_utils.py:41
Class
GpuOnlySurfacesTest
tests/test_adakv_headkv_kv_head.py:392
Class
HQQQuantizedCache
Quantized Cache class that uses `HQQ` as a backend to perform quantization. Current implementation supports `int2`, `int4`, `int8` dtypes. P
pyramidkv/cache_utils_think.py:766
Class
HeadKVKvHeadInvariantsTest
tests/test_adakv_headkv_kv_head.py:289
Class
HybridCache
Hybrid Cache class to be used with `torch.compile` for Gemma2 models that alternate between a local sliding window attention and global atten
pyramidkv/cache_utils_think.py:1437
Class
IsEmptyPastKeyValuesTest
tests/test_generation_state.py:30
Class
KVHeadModeShapeTest
kv_head mode invariants for every in-scope cluster on unrepeated GQA inputs.
tests/test_gqa_kv_head.py:76
Class
KVQuantizedCache
pyramidkv/quantcache.py:12
Class
KvSeqLenResetTest
tests/test_generation_state.py:48
Class
LlamaGQAIntegrationTest
tests/test_gqa_model_integration.py:111
Class
MambaCache
Cache for mamba model which does not have attention mechanism and key value states. Arguments: config (`PretrainedConfig):
pyramidkv/cache_utils_think.py:1596
Class
MergeKVTest
tests/test_merge_kv.py:8
Class
MiniCacheTest
tests/test_minicache.py:13
Class
MistralGQAIntegrationTest
tests/test_gqa_model_integration.py:183
Class
NACLSelectionTest
tests/test_nacl.py:12
Class
NoCompressionBelowCapacityTest
tests/test_gqa_kv_head.py:242
Class
OffloadedCache
A drop-in replacement for DynamicCache that conserves GPU memory at the expense of more CPU memory. Useful for generating from models with ve
pyramidkv/cache_utils_think.py:507
Class
QuantizationConfigTest
tests/test_quantization.py:11
Class
QuantizedCache
A quantizer cache similar to what is described in the [KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache paper](https://arxiv.org/abs
pyramidkv/cache_utils_think.py:619
Class
QuantizedCacheConfig
Configuration class for quantized cache settings. Attributes: backend (`str`, *optional*, defaults to `"quanto"`): Backe
pyramidkv/cache_utils_think.py:198
Class
QuantoQuantizedCache
Quantized Cache class that uses `quanto` as a backend to perform quantization. Current implementation supports `int2` and `int4` dtypes only.
pyramidkv/cache_utils_think.py:707
Class
QuestSelectionTest
tests/test_quest.py:13
Class
ScissorhandsSelectionTest
tests/test_scissorhands.py:12
Class
ScoreAggregationTest
tests/test_gqa_kv_head.py:194
Class
SinkCache
A cache that as described in the [Attention Sinks paper](https://arxiv.org/abs/2309.17453). It allows the model to generate beyond the length
pyramidkv/cache_utils_think.py:827
Class
SlidingWindowCache
Sliding Window Cache class to be used with `torch.compile` for models like Mistral that support sliding window attention. Every time when we
pyramidkv/cache_utils_think.py:1149
Class
SnapKVNaiveReferenceTest
tests/test_gqa_kv_head.py:181
Class
StaticCache
Static Cache class to be used with `torch.compile(model)` and `torch.export()`. Parameters: config (`PretrainedConfig`):
pyramidkv/cache_utils_think.py:1011