MCPcopy Create free account

hub / github.com/MuLabPKU/TransArch / functions

Functions302 in github.com/MuLabPKU/TransArch

↓ 13 callersMethod__init__
(self, config)
TransMLA_NeurIPS_2025/models/deepseek_v2_lite/modeling_deepseek.py:394
↓ 8 callersMethod__init__
(self, config, hidden_size=None, intermediate_size=None)
TransMLA_NeurIPS_2025/transmla/transformers/deepseek_v3/modeling_deepseek_v3.py:94
↓ 7 callersMethod__init__
(self, *, vllm_config: VllmConfig, prefix: str = "")
GQLA_preprint/src/vllm_model.py:274
↓ 5 callersMethod__init__
( self, hidden_size: int, intermediate_size: int, hidden_act: str, qua
TransMLA_NeurIPS_2025/transmla/vllm_registry/deepseek.py:63
↓ 5 callersFunctionyarn_get_mscale
(scale=1, mscale=1)
TransMLA_NeurIPS_2025/models/deepseek_v2_lite/modeling_deepseek.py:247
↓ 4 callersFunctionevaluate_ppl
Evaluate the model's perplexity on the test set using batch processing. It is expected that model is already on the correct device.
CLOVER_ICML_2025/src/pca_calc.py:54
↓ 4 callersFunctionfit_per_group_pca
Per-group PCA via eigh with 1% Tikhonov diagonal damping. Returns (G, full_dim, retained_dim).
GQLA_preprint/src/compression.py:271
↓ 4 callersFunctionrotate_half
Rotates half the hidden dims of the input.
TransMLA_NeurIPS_2025/transmla/transformers/deepseek_v3/modeling_deepseek_v3.py:212
↓ 3 callersMethod__init__
(self, config: Glm4MoeLiteConfig)
GQLA_preprint/src/modeling.py:39
↓ 3 callersFunctionapply_rotary_pos_emb_interleave
r""" TODO let's just use the original freqcis computation to not have the view transpose + reshape! This is not optimized! Applies Rotary
TransMLA_NeurIPS_2025/transmla/transformers/deepseek_v3/modeling_deepseek_v3.py:284
↓ 3 callersFunctionevaluate_ppl
Evaluate the model's perplexity on the test set using batch processing. It is expected that model is already on the correct device.
TransMLA_NeurIPS_2025/transmla/utils.py:206
↓ 3 callersFunctionfmt
(v)
GQLA_preprint/scripts/summarize_lm_eval.py:75
↓ 3 callersFunctionget_qkv_calibrate_outputs
Take the input signals ("activations") for a layer, run the layer forward.
TransMLA_NeurIPS_2025/transmla/utils.py:316
↓ 3 callersFunctionlayer_pca_calc
Run PCA on a list of batched data. Returns the eigenvalues and eigenvectors.
CLOVER_ICML_2025/src/pca_calc.py:187
↓ 3 callersFunctionpartial_rope_freqfold
(model, ori_qkv_outputs, test_loader, freqfold: int, collapse)
TransMLA_NeurIPS_2025/transmla/partial_rope.py:204
↓ 2 callersMethod__init__
(self, config: MixtralMLAConfig)
TransMLA_NeurIPS_2025/transmla/transformers/mixtral/modeling_mixtralmla.py:37
↓ 2 callersMethod__init__
(self, config: LlamaMLAConfig)
TransMLA_NeurIPS_2025/transmla/transformers/llama/modeling_llamamla.py:37
↓ 2 callersMethod__init__
(self, config: Gemma2MLAConfig)
TransMLA_NeurIPS_2025/transmla/transformers/gemma2/modeling_gemma2mla.py:37
↓ 2 callersMethod_set_cos_sin_cache
(self, seq_len, device, dtype)
TransMLA_NeurIPS_2025/models/deepseek_v2_lite/modeling_deepseek.py:134
↓ 2 callersFunctionapply_rotary_pos_emb
Applies Rotary Position Embedding to the query and key tensors. Args: q (`torch.Tensor`): The query tensor. k (`torch.Tensor`): T
TransMLA_NeurIPS_2025/models/deepseek_v2_lite/modeling_deepseek.py:339
↓ 2 callersFunctiondlt
(a, b)
GQLA_preprint/scripts/summarize_lm_eval.py:76
↓ 2 callersFunctionevaluate_ppl
Mean per-sequence next-token NLL, exp'd; logits chunked along seq axis for memory.
GQLA_preprint/src/compression.py:638
↓ 2 callersFunctiongather_calibration_hidden_states
Capture each layer's attention input (CPU bf16) via forward pre-hooks. Independent mode. If ``capture_final=True``, also captures the OUTPUT of t
GQLA_preprint/src/compression.py:113
↓ 2 callersFunctionget_dataset
Get the dataset from the HuggingFace datasets library. Args: name: The name of the HuggingFace dataset to load. Must be one of "wiki
CLOVER_ICML_2025/src/data.py:12
↓ 2 callersFunctionget_dataset
Load wikitext2 / alpaca / pg19 as HF datasets, normalised to a single 'text' column.
GQLA_preprint/src/compression.py:66
↓ 2 callersMethodget_input_embeddings
(self, input_ids: torch.Tensor)
TransMLA_NeurIPS_2025/transmla/vllm_registry/deepseek.py:500
↓ 2 callersFunctionmap_tensors
Recursively map tensors to device and dtype.
TransMLA_NeurIPS_2025/transmla/utils.py:190
↓ 2 callersFunctionmap_tensors
Recursively map tensors to device and dtype.
CLOVER_ICML_2025/src/pca_calc.py:38
↓ 2 callersFunctionmodel_slice
(model: nn.Module, dim: int, prune_lm_head=False)
CLOVER_ICML_2025/src/slice.py:54
↓ 2 callersFunctionparse_math_answer
(text: str, data_name)
TransMLA_NeurIPS_2025/lighteval/math_utils.py:420
↓ 2 callersFunctionpca_calc
(X: list[torch.Tensor], device: str)
TransMLA_NeurIPS_2025/transmla/utils.py:388
↓ 2 callersFunctionprepare_test_dataloader
Get a DataLoader from a test dataset. This dataloader should be used when comparing WikiText2 perplexities with other papers, e.g. SparseGPT (arx
CLOVER_ICML_2025/src/data.py:62
↓ 2 callersFunctionpreprocess
Comes from AiHarness
TransMLA_NeurIPS_2025/lighteval/tasks.py:12
↓ 2 callersFunctionrepeat_kv
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch, num_key_value_heads, seqlen, he
TransMLA_NeurIPS_2025/transmla/transformers/deepseek_v3/modeling_deepseek_v3.py:246
↓ 2 callersFunctionrotate_half
(x, group)
TransMLA_NeurIPS_2025/transmla/partial_rope.py:9
↓ 2 callersFunctionrotate_half
Rotates half the hidden dims of the input.
TransMLA_NeurIPS_2025/models/deepseek_v2_lite/modeling_deepseek.py:331
↓ 2 callersFunctionsync_gpus
Sync all GPUs to make sure all operations are finished, needed for correct benchmarking of latency/throughput.
TransMLA_NeurIPS_2025/transmla/utils.py:185
↓ 2 callersFunctionsync_gpus
Sync all GPUs to make sure all operations are finished, needed for correct benchmarking of latency/throughput.
CLOVER_ICML_2025/src/pca_calc.py:33
↓ 2 callersFunctiontotal_reserved_mem
()
CLOVER_ICML_2025/src/pca_calc.py:17
↓ 2 callersFunctionyarn_find_correction_dim
( num_rotations, dim, base=10000, max_position_embeddings=2048 )
TransMLA_NeurIPS_2025/models/deepseek_v2_lite/modeling_deepseek.py:226
↓ 1 callersFunction_expand_gqla_kv_b_weight
Expand a GQLA-packed kv_b_proj weight to MLA layout. Source: ``(num_kv_heads * per_head_kv, kv_lora_rank)`` — one (W_UK|W_UV) block per KV gr
GQLA_preprint/src/vllm_model.py:374
↓ 1 callersFunction_fix_a_slash_b
(string)
TransMLA_NeurIPS_2025/lighteval/math_utils.py:40
↓ 1 callersFunction_fix_fracs
(string)
TransMLA_NeurIPS_2025/lighteval/math_utils.py:8
↓ 1 callersFunction_fix_sqrt
(string)
TransMLA_NeurIPS_2025/lighteval/math_utils.py:57
↓ 1 callersMethod_flash_attention_forward
Calls the forward method of Flash Attention - if the input hidden states contain at least one padding token first unpad the input, th
TransMLA_NeurIPS_2025/models/deepseek_v2_lite/modeling_deepseek.py:1065
↓ 1 callersFunction_get_unpad_data
(attention_mask)
TransMLA_NeurIPS_2025/models/deepseek_v2_lite/modeling_deepseek.py:80
↓ 1 callersMethod_init_rope
(self)
TransMLA_NeurIPS_2025/models/deepseek_v2_lite/modeling_deepseek.py:753
↓ 1 callersMethod_init_weights
(self, self_attn, R_q, R_kv)
TransMLA_NeurIPS_2025/transmla/lora_qkv.py:132
↓ 1 callersMethod_insert_kv_up_proj
(self)
TransMLA_NeurIPS_2025/transmla/partial_rope.py:74
↓ 1 callersMethod_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_l
TransMLA_NeurIPS_2025/transmla/transformers/deepseek_v3/modeling_deepseek_v3.py:735
↓ 1 callersMethod_upad_input
( self, query_layer, key_layer, value_layer, attention_mask, query_length )
TransMLA_NeurIPS_2025/models/deepseek_v2_lite/modeling_deepseek.py:1145
↓ 1 callersMethod_update_causal_mask
( self, attention_mask: Union[torch.Tensor, "BlockMask"], input_tensor: torch.Tensor,
TransMLA_NeurIPS_2025/transmla/transformers/deepseek_v3/modeling_deepseek_v3.py:666
↓ 1 callersFunctionapply_rotary_pos_emb
(q, k, cos, sin, rope_head=1)
TransMLA_NeurIPS_2025/transmla/partial_rope.py:17
↓ 1 callersFunctionassemble_per_group_covs_from_full
Slice per-group ``(G, gs*d, gs*d)`` covs from the all-pair ``(H*d, H*d)`` cov. For group ``g``, the in-group head order is ``perm[g*gs:(g+1)*gs]`
GQLA_preprint/src/compression.py:361
↓ 1 callersFunctioncleanup_memory
Run GC and clear GPU memory.
CLOVER_ICML_2025/src/pca_calc.py:9
↓ 1 callersFunctioncollect_full_kv_grams
All-pair K/V covariance ``(H * d, H * d)``, fp64. Drives data-driven head grouping. Same kv_a chain as ``collect_kv_grams``; differs only in that
GQLA_preprint/src/compression.py:218
↓ 1 callersFunctioncollect_kv_grams
Stream the kv_a chain over calibration; accumulate per-group K/V covariance (fp64). If ``token_weights`` is provided (one ``(S,)`` fp32 tensor pe
GQLA_preprint/src/compression.py:161
↓ 1 callersFunctioncompose_compressed_with_perm
Compress + absorb for arbitrary head groupings (e.g. similarity-driven). For each new GQLA head ``h_new = g*gs + i`` with original head ``ori
GQLA_preprint/src/compression.py:514
↓ 1 callersFunctioncompress_and_absorb
Build compressed kv_b_proj + absorbed q_b_proj (nope rows) and o_proj (per-head v cols).
GQLA_preprint/src/compression.py:466
↓ 1 callersFunctioncompute_head_similarity
Nuclear-norm-of-cross-cov head similarity, weighted K + V contributions. For each pair ``(h, h')``, ``||Sigma^{h,h'}||_*`` is the negated optimal
GQLA_preprint/src/compression.py:287
↓ 1 callersFunctioncompute_token_weights_nll
Per-token NLL weights from the cached last-layer hidden states. Standard per-layer PCA accumulates ``Sigma_X = X.T @ X`` with uniform weights,
GQLA_preprint/src/compression.py:396
↓ 1 callersFunctionconvert_word_number
(text: str)
TransMLA_NeurIPS_2025/lighteval/math_utils.py:62
↓ 1 callersFunctiondiagnose_weights
Quick stats for logging Hessian-PCA token weights.
GQLA_preprint/src/compression.py:450
↓ 1 callersMethodembed_input_ids
(self, input_ids: torch.Tensor)
GQLA_preprint/src/vllm_model.py:308
↓ 1 callersMethodembed_input_ids
(self, input_ids: torch.Tensor)
GQLA_preprint/src/vllm_model.py:641
↓ 1 callersFunctionembed_tokens_hook_fn
(module, input, output)
CLOVER_ICML_2025/src/pca_calc.py:111
↓ 1 callersFunctionextract_answer
(pred_str, data_name, use_last_number=True)
TransMLA_NeurIPS_2025/lighteval/math_utils.py:350
↓ 1 callersMethodfrom_config
(cls, config, num_kv_heads: int)
GQLA_preprint/src/compression.py:46
↓ 1 callersFunctionfuse_to_attention_inputs
(self_attn: nn.Module, input_layernorm: torch.Tensor)
CLOVER_ICML_2025/src/fuse_rmsnorm.py:6
↓ 1 callersFunctionfuse_to_lm_head_input
(lm_head: nn.Module, lm_norm: torch.Tensor)
CLOVER_ICML_2025/src/fuse_rmsnorm.py:25
↓ 1 callersFunctionfuse_to_mlp_input
(mlp: nn.Module, post_attention_layernorm: torch.Tensor)
CLOVER_ICML_2025/src/fuse_rmsnorm.py:16
↓ 1 callersFunctionget_calibrate_outputs
Take the input signals ("activations") for a layer, run the layer forward.
CLOVER_ICML_2025/src/pca_calc.py:134
↓ 1 callersFunctionget_dataset
Get the dataset from the HuggingFace datasets library. Args: name: The name of the HuggingFace dataset to load. Must be one of "wiki
TransMLA_NeurIPS_2025/transmla/utils.py:10
↓ 1 callersFunctionget_dataset_loader
(tokenizer: AutoTokenizer, **kwargs)
TransMLA_NeurIPS_2025/transmla/converter.py:32
↓ 1 callersFunctionget_requests
(args, tokenizer)
TransMLA_NeurIPS_2025/throughput_test/benchmark_throughput.py:276
↓ 1 callersFunctionget_spec_layer_idx_from_weight_name
(config: PretrainedConfig, weight_name: str)
TransMLA_NeurIPS_2025/transmla/vllm_registry/deepseek.py:693
↓ 1 callersMethodget_topk_indices
(self, scores)
TransMLA_NeurIPS_2025/transmla/transformers/deepseek_v3/modeling_deepseek_v3.py:125
↓ 1 callersFunctiongreedy_balanced_grouping
Seed-and-grow balanced grouping: pick the best unassigned pair to seed each group, then iteratively add the unassigned head with highest sum-simil
GQLA_preprint/src/compression.py:320
↓ 1 callersFunctioninplace_apply_compressed
Replace kv_b_proj with the shrunken Linear; copy absorbed q/o weights; flip kv_groups.
GQLA_preprint/src/compression.py:590
↓ 1 callersFunctioninput_layernorm_hook_fn
(module, input, output, index)
CLOVER_ICML_2025/src/pca_calc.py:114
↓ 1 callersFunctioninsert_hooks
(model)
CLOVER_ICML_2025/src/pca_calc.py:104
↓ 1 callersFunctioninsert_qkv_hooks
(model)
TransMLA_NeurIPS_2025/transmla/utils.py:259
↓ 1 callersFunctioninsert_shortcut_and_fuse_rmsnorm
(model)
CLOVER_ICML_2025/src/fuse_rmsnorm.py:32
↓ 1 callersMethodjoint_complex_pca
(self, Z: list[torch.Tensor], freqfold: int = 1)
TransMLA_NeurIPS_2025/transmla/partial_rope.py:86
↓ 1 callersFunctionkey_hook_fn
(module, input, output, index)
TransMLA_NeurIPS_2025/transmla/utils.py:276
↓ 1 callersFunctionkv_a_proj_with_mqa_hook_fn
(module, input, output, index)
TransMLA_NeurIPS_2025/transmla/utils.py:291
↓ 1 callersFunctionload_model_and_tokenizer
(args)
TransMLA_NeurIPS_2025/transmla/converter.py:12
↓ 1 callersFunctionload_results
(out_root: Path, mode: str)
GQLA_preprint/scripts/summarize_lm_eval.py:18
↓ 1 callersFunctionload_results
(out_root: Path, mode: str)
GQLA_preprint/scripts/summarize_commonsense_2x2.py:31
↓ 1 callersFunctionlora_path_on_disk
(lora_path: str)
TransMLA_NeurIPS_2025/throughput_test/benchmark_dataset.py:214
↓ 1 callersFunctionlow_rank_qkv
(model, tokenizer, train_loader, test_loader, **kwargs)
TransMLA_NeurIPS_2025/transmla/lora_qkv.py:278
↓ 1 callersFunctionmain
(args: argparse.Namespace)
TransMLA_NeurIPS_2025/throughput_test/benchmark_throughput.py:300
↓ 1 callersFunctionmain
(args)
TransMLA_NeurIPS_2025/transmla/converter.py:52
↓ 1 callersFunctionmain
(args: argparse.Namespace)
CLOVER_ICML_2025/test.py:18
↓ 1 callersFunctionmain
(args: argparse.Namespace)
CLOVER_ICML_2025/slicegpt.py:26
↓ 1 callersFunctionmain
(args: argparse.Namespace)
CLOVER_ICML_2025/clover.py:16
↓ 1 callersFunctionmain
()
GQLA_preprint/src/convert.py:101
↓ 1 callersFunctionmain
()
GQLA_preprint/scripts/summarize_lm_eval.py:37
↓ 1 callersFunctionmain
()
GQLA_preprint/scripts/summarize_commonsense_2x2.py:45
↓ 1 callersFunctionmake_hook
(li)
GQLA_preprint/src/compression.py:126
next →1–100 of 302, ranked by callers