MCPcopy Create free account

hub / github.com/LUMIA-Group/MemoryDecoder / functions

Functions73 in github.com/LUMIA-Group/MemoryDecoder

↓ 2 callersMethod_get_arrow_file_path
Get the Arrow file path (single file for all processes)
knn_utils/saveEmbedMulti.py:310
↓ 2 callersMethodforward
Forward pass that returns **fused log‑probs** as logits. We keep separate caches for each sub‑model.
demo/memDec.py:57
↓ 2 callersMethodgenerate
Greedy decoding with **shared** stopping criteria. We keep two independent KV caches (one per sub‑model) and extend them step
demo/memDec.py:112
↓ 2 callersMethodget_model_last_layer
(model_type)
knn_utils/saveEmbedMulti.py:243
↓ 2 callersMethodregister_hook
(self, layer, func, pre=False)
knn_utils/saveEmbedMulti.py:205
↓ 2 callersMethodregister_hook
(self, layer, func, pre=False)
knn_utils/saveEmbedMulti.py:422
↓ 1 callersMethod__init__
(self, dstore_dir, dimension, knn_keytype=None, knn_gpu=False, training_args=None, eval_subset=None, accelerat
knn_utils/saveEmbedMulti.py:285
↓ 1 callersMethod_load_faiss_index
Load FAISS index and optionally move to GPU
knn_utils/saveKNNMulti.py:92
↓ 1 callersMethod_save_step_data
(self, keys, vals)
knn_utils/saveEmbedMulti.py:330
↓ 1 callersMethod_save_step_data
Save data for current step using streaming Arrow format
knn_utils/saveKNNMulti.py:180
↓ 1 callersMethod_setup_arrow_writer
Set up the Arrow writer for streaming writes (only on main process)
knn_utils/saveEmbedMulti.py:315
↓ 1 callersMethod_setup_arrow_writer
Set up Arrow writer for streaming writes (main process only)
knn_utils/saveKNNMulti.py:111
↓ 1 callersMethodbreak_into
(self, model)
knn_utils/saveEmbedMulti.py:373
↓ 1 callersMethodbreak_out
(self)
knn_utils/saveEmbedMulti.py:426
↓ 1 callersFunctionbuild_index
Build a FAISS index from an Arrow file containing keys and values. Args: dstore_path: Path to the Arrow file containing the data
knn_utils/build_index.py:126
↓ 1 callersFunctionget_dstore_path
(dstore_dir, model_type, eval_subset, dimension)
knn_utils/saveEmbedMulti.py:494
↓ 1 callersFunctionget_index_path
(dstore_dir, model_type, eval_subset, dimension)
knn_utils/saveEmbedMulti.py:497
↓ 1 callersFunctionget_index_path
Generate the path for the FAISS index file.
knn_utils/build_index.py:57
↓ 1 callersMethodget_knns
(self, queries)
knn_utils/saveEmbedMulti.py:143
↓ 1 callersMethodget_knns
(self, queries, ignore_first=False)
knn_utils/saveKNNMulti.py:130
↓ 1 callersFunctioninterpolate
(knn_log_probs, lm_log_probs, lmbda=0.25)
evaluate_joint.py:388
↓ 1 callersFunctioninterpolate
(knn_log_probs, lm_log_probs, lmbda=0.25)
utils/cal_loss.py:12
↓ 1 callersMethodinterpolate
(dists, knn_log_probs, lm_log_probs, lmbda)
knn_utils/saveEmbedMulti.py:235
↓ 1 callersFunctionjoint_evaluate
(logits, knn_logits, batch, tokenizer, args)
evaluate_joint.py:395
↓ 1 callersFunctionkl_loss_evaluate
(logits, batch, tokenizer, args, knn_label, knn_prob)
utils/cal_loss.py:19
↓ 1 callersFunctionkl_loss_token
(logits, batch, tokenizer, args, knn_label, knn_prob, alpha=0.5)
utils/cal_loss.py:49
↓ 1 callersMethodknns_to_log_prob
(self, knns, neg_dists)
knn_utils/saveEmbedMulti.py:197
↓ 1 callersMethodknns_to_probs
Compute kNN probability distribution following the reference implementation
knn_utils/saveKNNMulti.py:143
↓ 1 callersFunctionmain
()
evaluate_joint.py:295
↓ 1 callersFunctionmain
()
train_base.py:207
↓ 1 callersFunctionmain
()
train_memdec.py:318
↓ 1 callersFunctionmain
()
utils/preprocess_dataset.py:142
↓ 1 callersFunctionmain
()
knn_utils/saveKNNMulti.py:306
↓ 1 callersFunctionmain
()
knn_utils/build_index.py:204
↓ 1 callersFunctionparse_args
()
evaluate_joint.py:56
↓ 1 callersFunctionparse_args
()
train_memdec.py:77
↓ 1 callersFunctionparse_args
()
utils/preprocess_dataset.py:25
↓ 1 callersFunctionparse_args
()
knn_utils/saveKNNMulti.py:275
↓ 1 callersFunctionparse_dstore_path
Parse the dstore path to extract model_type, eval_subset, and dimension. Example: /fs-computility/plm/shared/jqcao/projects/neuralKN
knn_utils/build_index.py:20
↓ 1 callersMethodpre_forward_hook
(self, input_ids=None, attention_mask=None, labels=None, **kwargs)
knn_utils/saveEmbedMulti.py:150
↓ 1 callersMethodpre_forward_hook
(self, input_ids=None, attention_mask=None, labels=None, **kwargs)
knn_utils/saveEmbedMulti.py:409
↓ 1 callersMethodprocess
Main processing loop
knn_utils/saveKNNMulti.py:248
↓ 1 callersFunctionselect_continuous_chunks
Select continuous chunks of data from non-overlapping regions of the dataset. Args: dataset: The dataset to sample from
knn_utils/build_index.py:65
↓ 1 callersMethodsetup_faiss
(self)
knn_utils/saveEmbedMulti.py:76
↓ 1 callersMethodsparsify_distribution
Extract sparse representation of distribution with probs > threshold
knn_utils/saveKNNMulti.py:155
↓ 1 callersFunctiontokenize_and_group_text
(raw_datasets, tokenizer, block_size, stride, padding_index, num_process)
utils/preprocess_dataset.py:75
Method__init__
(self, val_file, index_file, dimension, knn_sim_func=None, knn_keytype=None, knn_gpu=True,
knn_utils/saveEmbedMulti.py:48
Method__init__
(self, layer, capture_input=False)
knn_utils/saveEmbedMulti.py:480
Method__init__
(self, dstore_path, val_path, index_path,
knn_utils/saveKNNMulti.py:21
Method__init__
( self, base_lm, knn_generator, lmbda: float = 0.25, knn_temp: float =
demo/memDec.py:40
Method__post_init__
(self)
train_base.py:130
Methodbreak_into
(self, model)
knn_utils/saveEmbedMulti.py:116
Methodbreak_out
(self)
knn_utils/saveEmbedMulti.py:209
Methodbuild_index
(self, num_keys_to_add_at_a_time=1_000_000, ncentroids=4096, seed=42, code_size=32, probe=8)
knn_utils/saveEmbedMulti.py:440
Methoddotprod
(query, keys)
knn_utils/saveEmbedMulti.py:227
Methodemit
(self, record: logging.LogRecord)
evaluate_joint.py:317
Methodemit
(self, record: logging.LogRecord)
train_base.py:229
Methodemit
(self, record: logging.LogRecord)
train_memdec.py:357
Methodforward
(self, module, input, output)
knn_utils/saveEmbedMulti.py:487
Methodforward_wrapper
(input_ids=None, attention_mask=None, labels=None, **kwargs)
knn_utils/saveEmbedMulti.py:126
Methodforward_wrapper
(input_ids=None, attention_mask=None, labels=None, **kwargs)
knn_utils/saveEmbedMulti.py:388
Methodfrom_string
(s)
knn_utils/saveEmbedMulti.py:30
Methodfrom_string
(s)
knn_utils/saveEmbedMulti.py:41
Methodget_metrics
(self)
knn_utils/saveEmbedMulti.py:216
Methodget_model_embedding_layer
(model_type)
knn_utils/saveEmbedMulti.py:249
Functionget_result_path
(dstore_dir, model_type, dstore_size, dimension)
knn_utils/saveEmbedMulti.py:500
Functiongroup_texts
(examples)
utils/preprocess_dataset.py:81
Functionknn_collate_fn
Custom collate function that handles kNN data processing directly Args: batch: The batch of data knn
train_memdec.py:428
Methodknns_to_probs
(self, knns, neg_dists)
knn_utils/saveEmbedMulti.py:188
Methodl2
(query, keys)
knn_utils/saveEmbedMulti.py:220
Methodpost_forward_hook
(self, module, input, output)
knn_utils/saveEmbedMulti.py:155
Methodpost_forward_hook
(self, module, input, output)
knn_utils/saveEmbedMulti.py:415
Functiontokenize_function
(examples)
utils/preprocess_dataset.py:77