SYMBOL INDEX (279 symbols across 22 files) FILE: config.py function set_template (line 14) | def set_template(args): FILE: dataloader/__init__.py function dataloader_factory (line 8) | def dataloader_factory(args): function test_subset_dataloader_loader (line 24) | def test_subset_dataloader_loader(args): FILE: dataloader/base.py class AbstractDataloader (line 5) | class AbstractDataloader(metaclass=ABCMeta): method __init__ (line 6) | def __init__(self, args, dataset): method code (line 21) | def code(cls): method get_pytorch_dataloaders (line 25) | def get_pytorch_dataloaders(self): FILE: dataloader/llm.py function worker_init_fn (line 17) | def worker_init_fn(worker_id): function generate_and_tokenize_eval (line 23) | def generate_and_tokenize_eval(args, data_point, tokenizer, prompter): function generate_and_tokenize_train (line 36) | def generate_and_tokenize_train(args, data_point, tokenizer, prompter): function seq_to_token_ids (line 60) | def seq_to_token_ids(args, seq, candidates, label, text_dict, tokenizer,... class LLMDataloader (line 83) | class LLMDataloader(): method __init__ (line 84) | def __init__(self, args, dataset): method code (line 150) | def code(cls): method get_pytorch_dataloaders (line 153) | def get_pytorch_dataloaders(self): method _get_train_loader (line 159) | def _get_train_loader(self): method _get_train_dataset (line 166) | def _get_train_dataset(self): method _get_val_loader (line 171) | def _get_val_loader(self): method _get_test_loader (line 174) | def _get_test_loader(self): method _get_eval_loader (line 177) | def _get_eval_loader(self, mode): method _get_eval_dataset (line 184) | def _get_eval_dataset(self, mode): class LLMTrainDataset (line 196) | class LLMTrainDataset(data_utils.Dataset): method __init__ (line 197) | def __init__(self, args, u2seq, max_len, rng, text_dict, tokenizer, pr... method __len__ (line 212) | def __len__(self): method __getitem__ (line 215) | def __getitem__(self, index): class LLMValidDataset (line 234) | class LLMValidDataset(data_utils.Dataset): method __init__ (line 235) | def __init__(self, args, u2seq, u2answer, max_len, rng, text_dict, tok... method __len__ (line 248) | def __len__(self): method __getitem__ (line 251) | def __getitem__(self, index): class LLMTestDataset (line 264) | class LLMTestDataset(data_utils.Dataset): method __init__ (line 265) | def __init__(self, args, u2seq, u2val, u2answer, max_len, rng, text_di... method __len__ (line 279) | def __len__(self): method __getitem__ (line 282) | def __getitem__(self, index): FILE: dataloader/lru.py function worker_init_fn (line 11) | def worker_init_fn(worker_id): class LRUDataloader (line 16) | class LRUDataloader(): method __init__ (line 17) | def __init__(self, args, dataset): method code (line 36) | def code(cls): method get_pytorch_dataloaders (line 39) | def get_pytorch_dataloaders(self): method get_pytorch_test_subset_dataloader (line 45) | def get_pytorch_test_subset_dataloader(self): method _get_train_loader (line 62) | def _get_train_loader(self): method _get_train_dataset (line 69) | def _get_train_dataset(self): method _get_val_loader (line 74) | def _get_val_loader(self): method _get_test_loader (line 77) | def _get_test_loader(self): method _get_eval_loader (line 80) | def _get_eval_loader(self, mode): method _get_eval_dataset (line 87) | def _get_eval_dataset(self, mode): class LRUTrainDataset (line 95) | class LRUTrainDataset(data_utils.Dataset): method __init__ (line 96) | def __init__(self, args, u2seq, max_len, sliding_size, rng): method __len__ (line 113) | def __len__(self): method __getitem__ (line 116) | def __getitem__(self, index): class LRUValidDataset (line 130) | class LRUValidDataset(data_utils.Dataset): method __init__ (line 131) | def __init__(self, args, u2seq, u2answer, max_len, rng): method __len__ (line 140) | def __len__(self): method __getitem__ (line 143) | def __getitem__(self, index): class LRUTestDataset (line 155) | class LRUTestDataset(data_utils.Dataset): method __init__ (line 156) | def __init__(self, args, u2seq, u2val, u2answer, max_len, rng, subset_... method __len__ (line 169) | def __len__(self): method __getitem__ (line 172) | def __getitem__(self, index): FILE: dataloader/utils.py class Prompter (line 6) | class Prompter(object): method __init__ (line 9) | def __init__(self, template_name: str = "", verbose: bool = False): method generate_prompt (line 24) | def generate_prompt( method get_response (line 44) | def get_response(self, output: str) -> str: FILE: datasets/__init__.py function dataset_factory (line 12) | def dataset_factory(args): FILE: datasets/base.py class AbstractDataset (line 17) | class AbstractDataset(metaclass=ABCMeta): method __init__ (line 18) | def __init__(self, args): method code (line 28) | def code(cls): method raw_code (line 32) | def raw_code(cls): method zip_file_content_is_folder (line 36) | def zip_file_content_is_folder(cls): method all_raw_file_names (line 40) | def all_raw_file_names(cls): method url (line 45) | def url(cls): method preprocess (line 49) | def preprocess(self): method load_ratings_df (line 53) | def load_ratings_df(self): method maybe_download_raw_dataset (line 57) | def maybe_download_raw_dataset(self): method load_dataset (line 60) | def load_dataset(self): method filter_triplets (line 66) | def filter_triplets(self, df): method densify_index (line 90) | def densify_index(self, df): method split_df (line 98) | def split_df(self, df, user_count): method _get_rawdata_root_path (line 110) | def _get_rawdata_root_path(self): method _get_rawdata_folder_path (line 113) | def _get_rawdata_folder_path(self): method _get_preprocessed_root_path (line 117) | def _get_preprocessed_root_path(self): method _get_preprocessed_folder_path (line 121) | def _get_preprocessed_folder_path(self): method _get_preprocessed_dataset_path (line 127) | def _get_preprocessed_dataset_path(self): FILE: datasets/beauty.py class BeautyDataset (line 19) | class BeautyDataset(AbstractDataset): method code (line 21) | def code(cls): method url (line 25) | def url(cls): method zip_file_content_is_folder (line 30) | def zip_file_content_is_folder(cls): method all_raw_file_names (line 34) | def all_raw_file_names(cls): method maybe_download_raw_dataset (line 37) | def maybe_download_raw_dataset(self): method preprocess (line 53) | def preprocess(self): method load_ratings_df (line 77) | def load_ratings_df(self): method load_meta_dict (line 84) | def load_meta_dict(self): FILE: datasets/games.py class GamesDataset (line 19) | class GamesDataset(AbstractDataset): method code (line 21) | def code(cls): method url (line 25) | def url(cls): method zip_file_content_is_folder (line 31) | def zip_file_content_is_folder(cls): method all_raw_file_names (line 35) | def all_raw_file_names(cls): method maybe_download_raw_dataset (line 38) | def maybe_download_raw_dataset(self): method preprocess (line 54) | def preprocess(self): method load_ratings_df (line 78) | def load_ratings_df(self): method load_meta_dict (line 85) | def load_meta_dict(self): FILE: datasets/ml_100k.py class ML100KDataset (line 18) | class ML100KDataset(AbstractDataset): method code (line 20) | def code(cls): method url (line 24) | def url(cls): # as of Sep 2023 method zip_file_content_is_folder (line 28) | def zip_file_content_is_folder(cls): method all_raw_file_names (line 32) | def all_raw_file_names(cls): method maybe_download_raw_dataset (line 38) | def maybe_download_raw_dataset(self): method preprocess (line 57) | def preprocess(self): method load_ratings_df (line 81) | def load_ratings_df(self): method load_meta_dict (line 88) | def load_meta_dict(self): FILE: datasets/utils.py function download (line 13) | def download(url, savepath): function unzip (line 18) | def unzip(zippath, savepath): function unziptargz (line 25) | def unziptargz(zippath, savepath): FILE: model/llm.py function _make_causal_mask (line 43) | def _make_causal_mask( function _expand_mask (line 61) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... class LlamaRMSNorm (line 75) | class LlamaRMSNorm(nn.Module): method __init__ (line 76) | def __init__(self, hidden_size, eps=1e-6): method forward (line 84) | def forward(self, hidden_states): class LlamaRotaryEmbedding (line 92) | class LlamaRotaryEmbedding(torch.nn.Module): method __init__ (line 93) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 107) | def _set_cos_sin_cache(self, seq_len, device, dtype): method forward (line 117) | def forward(self, x, seq_len=None): class LlamaLinearScalingRotaryEmbedding (line 128) | class LlamaLinearScalingRotaryEmbedding(LlamaRotaryEmbedding): method __init__ (line 131) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 135) | def _set_cos_sin_cache(self, seq_len, device, dtype): class LlamaDynamicNTKScalingRotaryEmbedding (line 147) | class LlamaDynamicNTKScalingRotaryEmbedding(LlamaRotaryEmbedding): method __init__ (line 150) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 154) | def _set_cos_sin_cache(self, seq_len, device, dtype): function rotate_half (line 173) | def rotate_half(x): function apply_rotary_pos_emb (line 180) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids): class LlamaMLP (line 191) | class LlamaMLP(nn.Module): method __init__ (line 192) | def __init__(self, config): method forward (line 202) | def forward(self, x): function repeat_kv (line 221) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class LlamaAttention (line 233) | class LlamaAttention(nn.Module): method __init__ (line 236) | def __init__(self, config: LlamaConfig): method _init_rope (line 258) | def _init_rope(self): method _shape (line 275) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 278) | def forward( class LlamaDecoderLayer (line 371) | class LlamaDecoderLayer(nn.Module): method __init__ (line 372) | def __init__(self, config: LlamaConfig): method forward (line 380) | def forward( class LlamaPreTrainedModel (line 456) | class LlamaPreTrainedModel(PreTrainedModel): method _init_weights (line 463) | def _init_weights(self, module): method _set_gradient_checkpointing (line 474) | def _set_gradient_checkpointing(self, module, value=False): class LlamaModel (line 547) | class LlamaModel(LlamaPreTrainedModel): method __init__ (line 555) | def __init__(self, config: LlamaConfig): method get_input_embeddings (line 568) | def get_input_embeddings(self): method set_input_embeddings (line 571) | def set_input_embeddings(self, value): method _prepare_decoder_attention_mask (line 575) | def _prepare_decoder_attention_mask(self, attention_mask, input_shape,... method forward (line 599) | def forward( class LlamaForCausalLM (line 727) | class LlamaForCausalLM(LlamaPreTrainedModel): method __init__ (line 730) | def __init__(self, config): method get_input_embeddings (line 740) | def get_input_embeddings(self): method set_input_embeddings (line 743) | def set_input_embeddings(self, value): method get_output_embeddings (line 746) | def get_output_embeddings(self): method set_output_embeddings (line 749) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 752) | def set_decoder(self, decoder): method get_decoder (line 755) | def get_decoder(self): method forward (line 760) | def forward( method prepare_inputs_for_generation (line 856) | def prepare_inputs_for_generation( method _reorder_cache (line 887) | def _reorder_cache(past_key_values, beam_idx): FILE: model/lru.py class LRURec (line 8) | class LRURec(nn.Module): method __init__ (line 9) | def __init__(self, args): method truncated_normal_init (line 16) | def truncated_normal_init(self, mean=0, std=0.02, lower=-0.04, upper=0... method forward (line 38) | def forward(self, x): class LRUEmbedding (line 44) | class LRUEmbedding(nn.Module): method __init__ (line 45) | def __init__(self, args): method get_mask (line 54) | def get_mask(self, x): method forward (line 57) | def forward(self, x): class LRUModel (line 63) | class LRUModel(nn.Module): method __init__ (line 64) | def __init__(self, args): method forward (line 73) | def forward(self, x, embedding_weight, mask): class LRUBlock (line 89) | class LRUBlock(nn.Module): method __init__ (line 90) | def __init__(self, args): method forward (line 99) | def forward(self, x, mask): class LRULayer (line 105) | class LRULayer(nn.Module): method __init__ (line 106) | def __init__(self, method lru_parallel (line 136) | def lru_parallel(self, i, h, lamb, mask, B, L, D): method forward (line 149) | def forward(self, x, mask): class PositionwiseFeedForward (line 164) | class PositionwiseFeedForward(nn.Module): method __init__ (line 165) | def __init__(self, d_model, d_ff, dropout=0.1): method forward (line 173) | def forward(self, x): FILE: train_ranker.py function main (line 30) | def main(args, export_root=None): FILE: train_retriever.py function main (line 21) | def main(args, export_root=None): FILE: trainer/base.py class BaseTrainer (line 20) | class BaseTrainer(metaclass=ABCMeta): method __init__ (line 21) | def __init__(self, args, model, train_loader, val_loader, test_loader,... method train (line 65) | def train(self): method train_one_epoch (line 77) | def train_one_epoch(self, epoch, accum_iter): method validate (line 104) | def validate(self, epoch, accum_iter): method test (line 125) | def test(self, epoch=-1, accum_iter=-1, save_name=None): method to_device (line 159) | def to_device(self, batch): method calculate_loss (line 163) | def calculate_loss(self, batch): method calculate_metrics (line 167) | def calculate_metrics(self, batch): method clip_gradients (line 170) | def clip_gradients(self, limit=1.0): method _update_meter_set (line 173) | def _update_meter_set(self, meter_set, metrics): method _update_dataloader_metrics (line 177) | def _update_dataloader_metrics(self, tqdm_dataloader, meter_set): method _create_optimizer (line 187) | def _create_optimizer(self): method get_linear_schedule_with_warmup (line 205) | def get_linear_schedule_with_warmup(self, optimizer, num_warmup_steps,... method _create_loggers (line 215) | def _create_loggers(self): method _create_state_dict (line 241) | def _create_state_dict(self): FILE: trainer/llm.py function llama_collate_fn_w_truncation (line 23) | def llama_collate_fn_w_truncation(llm_max_length, eval=False): function compute_metrics_for_ks (line 62) | def compute_metrics_for_ks(ks, verbalizer): class LLMTrainer (line 73) | class LLMTrainer(Trainer): method __init__ (line 74) | def __init__( method test (line 141) | def test(self, test_retrieval): method get_train_dataloader (line 164) | def get_train_dataloader(self): method get_eval_dataloader (line 167) | def get_eval_dataloader(self, eval_dataset: Optional[Dataset] = None) ... method get_test_dataloader (line 170) | def get_test_dataloader(self, test_dataset: Optional[Dataset] = None) ... FILE: trainer/loggers.py function save_state_dict (line 6) | def save_state_dict(state_dict, path, filename): class LoggerService (line 10) | class LoggerService(object): method __init__ (line 11) | def __init__(self, args, writer, val_loggers, test_loggers, use_wandb): method complete (line 18) | def complete(self): method log_val (line 24) | def log_val(self, log_data): method log_test (line 32) | def log_test(self, log_data): class AbstractBaseLogger (line 37) | class AbstractBaseLogger(metaclass=ABCMeta): method log (line 39) | def log(self, *args, **kwargs): method complete (line 42) | def complete(self, *args, **kwargs): class MetricGraphPrinter (line 46) | class MetricGraphPrinter(AbstractBaseLogger): method __init__ (line 47) | def __init__(self, key, graph_name, group_name, use_wandb): method log (line 53) | def log(self, writer, *args, **kwargs): method complete (line 62) | def complete(self, writer, *args, **kwargs): class RecentModelLogger (line 66) | class RecentModelLogger(AbstractBaseLogger): method __init__ (line 67) | def __init__(self, args, checkpoint_path, filename='checkpoint-recent.... method log (line 75) | def log(self, *args, **kwargs): method complete (line 84) | def complete(self, *args, **kwargs): class BestModelLogger (line 89) | class BestModelLogger(AbstractBaseLogger): method __init__ (line 90) | def __init__(self, args, checkpoint_path, metric_key, filename='best_a... method log (line 101) | def log(self, *args, **kwargs): FILE: trainer/lru.py class LRUTrainer (line 18) | class LRUTrainer(BaseTrainer): method __init__ (line 19) | def __init__(self, args, model, train_loader, val_loader, test_loader,... method calculate_loss (line 23) | def calculate_loss(self, batch): method calculate_metrics (line 31) | def calculate_metrics(self, batch, exclude_history=True): method generate_candidates (line 43) | def generate_candidates(self, retrieved_data_path): FILE: trainer/utils.py function ndcg (line 17) | def ndcg(scores, labels, k): function absolute_recall_mrr_ndcg_for_ks (line 32) | def absolute_recall_mrr_ndcg_for_ks(scores, labels, ks): class AverageMeterSet (line 63) | class AverageMeterSet(object): method __init__ (line 64) | def __init__(self, meters=None): method __getitem__ (line 67) | def __getitem__(self, key): method update (line 74) | def update(self, name, value, n=1): method reset (line 79) | def reset(self): method values (line 83) | def values(self, format_string='{}'): method averages (line 86) | def averages(self, format_string='{}'): method sums (line 89) | def sums(self, format_string='{}'): method counts (line 92) | def counts(self, format_string='{}'): class AverageMeter (line 96) | class AverageMeter(object): method __init__ (line 99) | def __init__(self): method reset (line 105) | def reset(self): method update (line 111) | def update(self, val, n=1): method __format__ (line 117) | def __format__(self, format): FILE: trainer/verb.py function convert_cfg_to_dict (line 22) | def convert_cfg_to_dict(cfg_node, key_list=[]): function signature (line 36) | def signature(f): class Verbalizer (line 72) | class Verbalizer(nn.Module): method __init__ (line 80) | def __init__(self, method label_words (line 101) | def label_words(self,): method label_words (line 112) | def label_words(self, label_words): method _match_label_words_to_label_ids (line 119) | def _match_label_words_to_label_ids(self, label_words): # TODO newly a... method safe_on_label_words_set (line 141) | def safe_on_label_words_set(self,): method on_label_words_set (line 146) | def on_label_words_set(self,): method vocab (line 152) | def vocab(self,) -> Dict: method vocab_size (line 158) | def vocab_size(self,) -> int: method generate_parameters (line 162) | def generate_parameters(self, **kwargs) -> List: method register_calibrate_logits (line 179) | def register_calibrate_logits(self, logits: torch.Tensor): method process_outputs (line 187) | def process_outputs(self, method gather_outputs (line 201) | def gather_outputs(self, outputs: ModelOutput): method aggregate (line 215) | def aggregate(label_words_logits: torch.Tensor) -> torch.Tensor: method normalize (line 232) | def normalize(self, logits: torch.Tensor) -> torch.Tensor: method project (line 246) | def project(self, method handle_multi_token (line 261) | def handle_multi_token(self, label_words_logits, mask): method from_config (line 285) | def from_config(cls, method from_file (line 313) | def from_file(self, class ManualVerbalizer (line 381) | class ManualVerbalizer(Verbalizer): method __init__ (line 393) | def __init__(self, method on_label_words_set (line 408) | def on_label_words_set(self): method add_prefix (line 418) | def add_prefix(label_words, prefix): method generate_parameters (line 443) | def generate_parameters(self) -> List: method project (line 471) | def project(self, method process_logits (line 490) | def process_logits(self, logits: torch.Tensor, **kwargs): method normalize (line 528) | def normalize(self, logits: torch.Tensor) -> torch.Tensor: method aggregate (line 543) | def aggregate(self, label_words_logits: torch.Tensor) -> torch.Tensor: method calibrate (line 555) | def calibrate(self, label_words_probs: torch.Tensor, **kwargs) -> torc...