MCPcopy Create free account

hub / github.com/Zefan-Cai/KVCache-Factory / functions

Functions410 in github.com/Zefan-Cai/KVCache-Factory

↓ 2 callersMethodupdate_think
(self, key_states, query_states, value_states, attention_mask, num_key_value_groups)
pyramidkv/pyramidkv_utils.py:561
↓ 2 callersFunctionwhite_space_fix
(text)
metrics.py:18
↓ 1 callersMethod__init__
(self, start_budget_ratio = 0.1, window_size = 64, max_capacity_prompt = 256 + 64, kernel_size = 5, pooling =
pyramidkv/pyramidkv_utils.py:653
↓ 1 callersMethod_apply_key_rotary_pos_emb
( self, key_states: torch.Tensor, cos: torch.Tensor, sin: torch.Tensor )
pyramidkv/cache_utils_think.py:876
↓ 1 callersMethod_check_metadata
(self, cluster, k_out, v_out)
tests/test_adakv_headkv_kv_head.py:182
↓ 1 callersFunction_check_pair
(current_states: torch.Tensor, previous_states: torch.Tensor)
pyramidkv/minicache.py:10
↓ 1 callersFunction_expand_pages_to_tokens
( page_indices: torch.Tensor, *, page_size: int, prefix_len: int, token_budget: int, )
pyramidkv/quest.py:118
↓ 1 callersMethod_get_rerotation_cos_sin
( self, key_states: torch.Tensor, cos: torch.Tensor, sin: torch.Tensor )
pyramidkv/cache_utils_think.py:882
↓ 1 callersMethod_handle_outliers
(self, tensor)
pyramidkv/quantcache.py:51
↓ 1 callersFunction_last_query
(query_states: torch.Tensor)
pyramidkv/quest.py:16
↓ 1 callersFunction_llama_config
(num_kv_heads, attn_impl="eager")
tests/test_gqa_model_integration.py:28
↓ 1 callersFunction_load_reference_module
()
tests/test_query_head_bitident.py:35
↓ 1 callersFunction_load_reference_module
()
tests/test_adakv_headkv_kv_head.py:63
↓ 1 callersFunction_mistral_config
(num_kv_heads, attn_impl="eager")
tests/test_gqa_model_integration.py:41
↓ 1 callersFunction_prepare_4d_causal_attention_mask_with_cache_position
Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape `(batch_size, key_value_length)`,
pyramidkv/llama_model.py:2602
↓ 1 callersFunction_prepare_4d_causal_attention_mask_with_cache_position
Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape `(batch_size, key_value_length)`,
pyramidkv/llama_model_think.py:235
↓ 1 callersFunction_protected_indices
( key_len: int, *, sink_size: int, recent_size: int, device: torch.device, )
pyramidkv/scissorhands.py:51
↓ 1 callersFunction_pyramidkv_scheduled_capacities
Replicate PyramidKVCluster's per-layer kept-token schedule (long branch).
tests/test_gqa_model_integration.py:93
↓ 1 callersMethod_rotate_half
(x)
pyramidkv/cache_utils_think.py:871
↓ 1 callersFunction_sample_by_importance
( scores: torch.Tensor, candidates: torch.Tensor, count: int, *, generator: torch.Generato
pyramidkv/scissorhands.py:68
↓ 1 callersFunction_sample_without_replacement
( scores: torch.Tensor, candidates: torch.Tensor, sample_count: int, *, generator: torch.G
pyramidkv/nacl.py:87
↓ 1 callersMethod_update_kv_kv_head
kv_head-granularity path (groups > 1: unrepeated GQA key/value tensors). Window scores are computed with transiently repeated keys, group-red
pyramidkv/pyramidkv_utils.py:440
↓ 1 callersMethod_update_kv_kv_head
kv_head-granularity path (groups > 1: unrepeated GQA key/value tensors). Window scores are computed with transiently repeated keys, group-red
pyramidkv/pyramidkv_utils.py:541
↓ 1 callersMethod_update_kv_kv_head
kv_head-granularity path (groups > 1: unrepeated GQA key/value tensors). Window scores are computed with transiently repeated keys, then the
pyramidkv/pyramidkv_utils.py:741
↓ 1 callersMethod_update_kv_kv_head
kv_head-granularity path (groups > 1: unrepeated GQA key/value tensors). H2O keeps its full-matrix scoring; the only extra full-size tensor i
pyramidkv/pyramidkv_utils.py:863
↓ 1 callersFunctionapply_monkeypatch
(model_path, method)
scripts/benchmark_latency_memory.py:30
↓ 1 callersMethodbound_evaluate_and_log
(self, *args)
run_needle_in_haystack.py:227
↓ 1 callersFunctionbuild_chat
(prompt)
run_ruler.py:55
↓ 1 callersFunctionbuild_chat
(prompt)
run_longbench.py:103
↓ 1 callersFunctionbuild_chat_llama3
(prompt)
run_longbench.py:107
↓ 1 callersFunctioncompress_minicache_pair
Compress one adjacent-layer KV pair using the MiniCache core contract.
pyramidkv/minicache.py:105
↓ 1 callersFunctionconfigure_kv_method
(model, args)
scripts/benchmark_latency_memory.py:44
↓ 1 callersMethodcrop
Crop the past key values up to a new `max_length` in terms of tokens. `max_length` can also be negative to remove `max_length` tokens. This is
pyramidkv/cache_utils_think.py:456
↓ 1 callersFunctioncuda_stats
()
scripts/benchmark_latency_memory.py:71
↓ 1 callersMethodencode_and_trim
(self, context, context_length)
run_needle_in_haystack.py:478
↓ 1 callersMethodevaluate_and_log
(self, context_length, depth_percent)
run_needle_in_haystack.py:266
↓ 1 callersMethodgenerate_context
(self, context_length, depth_percent)
run_needle_in_haystack.py:381
↓ 1 callersMethodgenerate_prompt
(self, context)
run_needle_in_haystack.py:239
↓ 1 callersMethodget_context_length_in_tokens
(self, context)
run_needle_in_haystack.py:447
↓ 1 callersMethodget_seq_length
Returns the sequence length of the cached states. A layer index can be optionally passed.
pyramidkv/cache_utils_think.py:904
↓ 1 callersMethodget_tokens_from_context
(self, context)
run_needle_in_haystack.py:464
↓ 1 callersFunctioninit_minference
(model_name)
pyramidkv/minference.py:9
↓ 1 callersMethodinsert_needle
(self, context, depth_percent, context_length)
run_needle_in_haystack.py:405
↓ 1 callersFunctionkey_pruner_query_driven
(kv_states, q_states, recent_size=128, ratio=0.3)
pyramidkv/pyramidkv_utils.py:26
↓ 1 callersMethodlogistic
(self, x, L=100, x0=50, k=.1)
run_needle_in_haystack.py:220
↓ 1 callersFunctionmain
(args)
run_ruler.py:66
↓ 1 callersFunctionmain
(args)
run_longbench.py:138
↓ 1 callersFunctionmain
(args)
scripts/benchmark_latency_memory.py:121
↓ 1 callersFunctionmain
()
scripts/scripts_needle/visualize.py:15
↓ 1 callersFunctionmake_inputs
(seed, num_q_heads, num_kv_heads, q_len, dtype=torch.float32)
tests/test_query_head_bitident.py:58
↓ 1 callersFunctionparse_args
(args=None)
eval.py:43
↓ 1 callersFunctionparse_args
(args=None)
eval_ruler.py:10
↓ 1 callersFunctionparse_args
()
scripts/benchmark_latency_memory.py:172
↓ 1 callersMethodprefetch_layer
Starts prefetching the next layer cache
pyramidkv/cache_utils_think.py:528
↓ 1 callersMethodprint_start_test_summary
(self)
run_needle_in_haystack.py:487
↓ 1 callersMethodread_context_files
(self)
run_needle_in_haystack.py:454
↓ 1 callersFunctionread_prompt
(args)
scripts/benchmark_latency_memory.py:21
↓ 1 callersFunctionremove_articles
(text)
metrics.py:15
↓ 1 callersFunctionrestore_minicache_pair
Restore approximate current/previous states from a MiniCache pair.
pyramidkv/minicache.py:141
↓ 1 callersMethodresult_exists
Checks to see if a result has already been evaluated or not
run_needle_in_haystack.py:359
↓ 1 callersFunctionrouge_score
(prediction, ground_truth, **kwargs)
metrics.py:104
↓ 1 callersMethodrun_test
(self, args)
run_needle_in_haystack.py:230
↓ 1 callersFunctionscorer
(dataset, predictions, answers, all_classes)
eval.py:67
↓ 1 callersFunctionset_seed
(seed)
run_ruler.py:46
↓ 1 callersFunctionset_seed
(seed)
run_longbench.py:94
↓ 1 callersFunctionset_seed
(seed)
scripts/benchmark_latency_memory.py:11
↓ 1 callersMethodstart_test
(self, args)
run_needle_in_haystack.py:496
↓ 1 callersFunctionstring_match_all
evaluation metric for RULER preds: List[str] refs: List[List[str]]
metrics.py:146
↓ 1 callersMethodto_dict
Serializes this instance to a Python dictionary. Returns: `Dict[str, Any]`: Dictionary of all the attributes that make up this co
pyramidkv/cache_utils_think.py:148
↓ 1 callersMethodto_json_string
Serializes this instance to a JSON formatted string. Returns: str: JSON formatted string representing the configuration i
pyramidkv/cache_utils_think.py:165
↓ 1 callersFunctionupdate_scissorhands_importance
Update persistent token importance with optional exponential decay.
pyramidkv/scissorhands.py:30
↓ 1 callersMethodupdate_think
Updates the cache with the new `key_states` and `value_states` for the layer `layer_idx`. Parameters: key_states (`torch
pyramidkv/cache_utils_think.py:390
↓ 1 callersFunctionwrite_run_meta
(save_dir, args)
run_longbench.py:111
Method__getitem__
(self, layer_idx: int)
pyramidkv/pyramidkv_utils.py:59
Method__getitem__
Support for backwards-compatible `past_key_value` indexing, e.g. `past_key_value[0][0].shape[2]` to get the sequence length.
pyramidkv/cache_utils_think.py:328
Method__getitem__
Gets the cache for this layer to the device. Prefetches the next and evicts the previous layer.
pyramidkv/cache_utils_think.py:545
Method__getitem__
Support for backwards-compatible `past_key_value` indexing, e.g. `past_key_value[0][0].shape[2]` to get the sequence length.
pyramidkv/cache_utils_think.py:1303
Method__init__
:param needle: The needle to be found in the haystack. Default is None. :param haystack_dir: The directory of text files to u
run_needle_in_haystack.py:37
Method__init__
(self)
pyramidkv/pyramidkv_utils.py:45
Method__init__
(self, num_hidden_layers = 32, window_size = 64, max_capacity_prompt = 256 + 64, kernel_size = 5, pooling = 'a
pyramidkv/pyramidkv_utils.py:324
Method__init__
(self, window_size = 64, max_capacity_prompt = 256 + 64, kernel_size = 5, pooling = 'avgpool', merge = None, r
pyramidkv/pyramidkv_utils.py:473
Method__init__
(self, max_capacity_prompt:int=256+64, layer_idx:int=0, skip_layers: List[int] = [], gqa_score_agg:str='mean')
pyramidkv/pyramidkv_utils.py:607
Method__init__
(self, window_size = 64, max_capacity_prompt = 256 + 64, kernel_size = 5, pooling = 'avgpool', merge = None, g
pyramidkv/pyramidkv_utils.py:798
Method__init__
(self, window_size = 64, max_capacity_prompt = 256 + 64, kernel_size = 5, pooling = 'avgpool', merge = None, g
pyramidkv/pyramidkv_utils.py:894
Method__init__
(self, window_size = 32, kernel_size = 7, pooling = 'maxpool',max_capacity_prompt=None,floor = None,normalize=
pyramidkv/pyramidkv_utils.py:949
Method__init__
(self, window_size = 32, kernel_size = 7, pooling = 'maxpool',max_capacity_prompt=None, layer_idx = None, num_
pyramidkv/pyramidkv_utils.py:1098
Method__init__
( self, backend: str = "quanto", nbits: Optional[int] = 4, axis_key: Optional[
pyramidkv/cache_utils_think.py:223
Method__init__
(self)
pyramidkv/cache_utils_think.py:320
Method__init__
(self)
pyramidkv/cache_utils_think.py:520
Method__init__
(self, cache_config: QuantizedCacheConfig)
pyramidkv/cache_utils_think.py:633
Method__init__
(self, cache_config: CacheConfig)
pyramidkv/cache_utils_think.py:734
Method__init__
(self, cache_config: CacheConfig)
pyramidkv/cache_utils_think.py:793
Method__init__
(self, window_length: int, num_sink_tokens: int)
pyramidkv/cache_utils_think.py:859
Method__init__
(self, config: PretrainedConfig, max_batch_size: int, max_cache_len: int, device, dtype=None)
pyramidkv/cache_utils_think.py:1046
Method__init__
(self, config: PretrainedConfig, max_batch_size: int, max_cache_len: int, device, dtype=None)
pyramidkv/cache_utils_think.py:1197
Method__init__
(self, self_attention_cache: Cache, cross_attention_cache: Cache)
pyramidkv/cache_utils_think.py:1294
Method__init__
(self, config: PretrainedConfig, max_batch_size, max_cache_len, device="cpu", dtype=None)
pyramidkv/cache_utils_think.py:1474
Method__init__
( self, config: PretrainedConfig, max_batch_size: int, dtype: torch.dtype = to
pyramidkv/cache_utils_think.py:1641
Method__init__
(self, cache_config, outlier_threshold=6.0)
pyramidkv/quantcache.py:13
Method__init__
(self, num_layers=0)
tests/test_generation_state.py:9
← previousnext →101–200 of 410, ranked by callers