MCPcopy Create free account

hub / github.com/THUDM/P-tuning / functions

Functions222 in github.com/THUDM/P-tuning

↓ 13 callersMethodshortenable
Return an instance of this string that is marked as shortenable
PT-Fewshot/data_utils/task_pvps.py:90
↓ 8 callersMethodfrom_pretrained
Load a pretrained wrapper from a given path.
PT-Fewshot/pet/wrapper.py:190
↓ 6 callersMethodgenerate_default_inputs
(self, batch: Dict[str, torch.Tensor])
PT-Fewshot/pet/wrapper.py:564
↓ 6 callersMethodload
Load a config from a file.
PT-Fewshot/pet/config.py:18
↓ 5 callersMethod_create_examples
(self, path: str, set_type: str, hypothesis_name: str = "hypothesis", premise_name: s
PT-Fewshot/data_utils/task_processors.py:147
↓ 5 callersMethod_create_examples
(path: str, set_type: str)
PT-Fewshot/data_utils/task_processors.py:200
↓ 5 callersMethod_create_examples
(path: str, set_type: str)
PT-Fewshot/data_utils/task_processors.py:240
↓ 5 callersMethod_create_examples
(path: str, set_type: str)
PT-Fewshot/data_utils/task_processors.py:320
↓ 5 callersMethod_create_examples
(path: str, set_type: str)
PT-Fewshot/data_utils/task_processors.py:359
↓ 5 callersMethod_create_examples
(path: str, set_type: str)
PT-Fewshot/data_utils/task_processors.py:415
↓ 5 callersMethod_create_examples
(path, set_type, seed=42, max_train_candidates_per_question: int = 10)
PT-Fewshot/data_utils/task_processors.py:472
↓ 5 callersMethodeval
(self, eval_data: List[InputExample], per_gpu_eval_batch_size: int = 8,
PT-Fewshot/pet/wrapper.py:476
↓ 5 callersMethodeval_dev
(self, dev_data, eval_config, n_gpu)
PT-Fewshot/pet/wrapper.py:453
↓ 5 callersFunctionget_verbalization_ids
Get the token ids corresponding to a verbalization :param word: the verbalization :param tokenizer: the tokenizer to use :param force
PT-Fewshot/pet/utils.py:265
↓ 5 callersFunctionload_file
(filename)
LAMA/data_utils/dataset.py:7
↓ 4 callersMethod_create_examples
Creates examples for the training and dev sets.
PT-Fewshot/data_utils/custom_task_processor.py:95
↓ 4 callersMethod_seq_length
(parts: List[Tuple[str, bool]], only_shortenable: bool = False)
PT-Fewshot/data_utils/task_pvps.py:168
↓ 4 callersMethodadd
Add a new input example to this list. :param example: the example to add :returns: `true` iff the example was actually added
PT-Fewshot/data_utils/task_processors.py:73
↓ 4 callersFunctionevaluate
(model: TransformerModelWrapper, eval_data: List[InputExample], config: EvalConfig)
PT-Fewshot/pet/modeling.py:206
↓ 3 callersMethodencode
Encode an input example using this pattern-verbalizer pair. :param example: the input example to encode :param priming: whet
PT-Fewshot/data_utils/task_pvps.py:108
↓ 3 callersFunctioneq_div
Equally divide N examples among i buckets. For example, `eq_div(12,3) = [4,4,4]`.
PT-Fewshot/pet/utils.py:199
↓ 3 callersMethodevaluate
(self, epoch_idx, evaluate_type)
LAMA/cli.py:117
↓ 3 callersMethodget_labels
(self)
PT-Fewshot/data_utils/task_processors.py:174
↓ 3 callersFunctionload_examples
Load examples for a given task.
PT-Fewshot/data_utils/task_processors.py:584
↓ 3 callersMethodremove_final_punc
Remove the final punctuation mark
PT-Fewshot/data_utils/task_pvps.py:95
↓ 3 callersMethodverbalize
Return all verbalizations for a given label. :param label: the label :return: the list of verbalizations
PT-Fewshot/data_utils/task_pvps.py:205
↓ 2 callersMethod_convert_single_mlm_logits_to_cls_logits
(self, logits: torch.Tensor)
PT-Fewshot/data_utils/task_pvps.py:225
↓ 2 callersMethod_generate_dataset
(self, data: List[InputExample], labelled: bool = True)
PT-Fewshot/pet/wrapper.py:529
↓ 2 callersMethod_remove_last
(parts: List[Tuple[str, bool]])
PT-Fewshot/data_utils/task_pvps.py:172
↓ 2 callersMethodconvert_mlm_logits_to_cls_logits
(self, mlm_labels: torch.Tensor, logits: torch.Tensor)
PT-Fewshot/data_utils/task_pvps.py:220
↓ 2 callersFunctionexact_match
Compute the exact match (EM) for a sequence of predictions and actual labels
PT-Fewshot/pet/utils.py:311
↓ 2 callersMethodget_save_path
(self)
LAMA/cli.py:151
↓ 2 callersFunctionget_vocab_by_strategy
(args, tokenizer)
LAMA/data_utils/vocab.py:37
↓ 2 callersMethodlowercase_first
Lowercase the first character
PT-Fewshot/data_utils/task_pvps.py:102
↓ 2 callersMethodsave
(self, best_ckpt)
LAMA/cli.py:166
↓ 2 callersMethodsave
Save this config to a file.
PT-Fewshot/pet/config.py:12
↓ 2 callersMethodsave
(self, path: str)
PT-Fewshot/pet/wrapper.py:163
↓ 2 callersFunctionsave_logits
Save an array of logits to a file
PT-Fewshot/pet/utils.py:220
↓ 2 callersFunctionsave_predictions
Save a sequence of predictions to a file
PT-Fewshot/pet/utils.py:228
↓ 2 callersFunctiontoken_wrapper
(args, token)
LAMA/data_utils/vocab.py:11
↓ 1 callersMethod__init__
Create a new LogitsList. :param score: the corresponding PET model's score on the training set :param logits: the list of log
PT-Fewshot/pet/utils.py:31
↓ 1 callersMethod__init__
Create a new task helper. :param wrapper: The wrapper for the language model being used.
PT-Fewshot/pet/task_helpers.py:34
↓ 1 callersFunction__setup_custom_logger
(name: str)
PT-Fewshot/log.py:21
↓ 1 callersMethod_build_mlm_logits_to_cls_logits_tensor
(self)
PT-Fewshot/data_utils/task_pvps.py:62
↓ 1 callersMethod_convert_examples_to_features
(self, examples: List[InputExample], labelled: bool = True)
PT-Fewshot/pet/wrapper.py:547
↓ 1 callersMethod_get_choice_log_probability
(self, batch, target_sequence, decoding_strategy: str = 'default')
PT-Fewshot/pet/task_helpers.py:128
↓ 1 callersMethod_load_config
(path: str)
PT-Fewshot/pet/wrapper.py:231
↓ 1 callersMethod_save_config
(self, path: str)
PT-Fewshot/pet/wrapper.py:225
↓ 1 callersFunction_shuffle_and_restrict
Shuffle a list of examples and restrict it to a given maximum size. :param examples: the examples to shuffle and restrict :param num_exa
PT-Fewshot/data_utils/task_processors.py:32
↓ 1 callersFunction_write_results
(path: str, all_results: Dict, dev32_results: Dict)
PT-Fewshot/pet/modeling.py:232
↓ 1 callersMethodadd_features_to_dict
Add special features from the ``meta`` dictionary of a sequence of features to the corresponding dictionary :param features: the sequ
PT-Fewshot/pet/task_helpers.py:67
↓ 1 callersMethodadd_special_input_features
Add special features to the ``meta`` dictionary of a feature set :param input_example: the input example considered :param in
PT-Fewshot/pet/task_helpers.py:58
↓ 1 callersMethodbuild_model
Build a new model instance.
LAMA/megatron_11b/models.py:10
↓ 1 callersFunctionconstruct_generation_args
()
LAMA/cli.py:31
↓ 1 callersFunctioncreate_model
(args)
LAMA/p_tuning/models.py:4
↓ 1 callersMethodembed_input
(self, queries)
LAMA/p_tuning/modeling.py:57
↓ 1 callersMethodeval_step
Custom implementation of the eval step for this task. :param batch: a batch of examples :return: a tensor of logits
PT-Fewshot/pet/task_helpers.py:50
↓ 1 callersMethodget_TREx_parameters
(self)
LAMA/cli.py:111
↓ 1 callersMethodget_checkpoint
(self, epoch_idx, dev_hit1, test_hit1)
LAMA/cli.py:155
↓ 1 callersMethodget_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:141
↓ 1 callersMethodget_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:132
↓ 1 callersFunctionget_embedding_layer
(args, model)
LAMA/p_tuning/models.py:29
↓ 1 callersMethodget_input_features
Convert the given example into a set of input features
PT-Fewshot/pet/preprocessor.py:38
↓ 1 callersMethodget_mask_positions
(self, input_ids: List[int])
PT-Fewshot/data_utils/task_pvps.py:214
↓ 1 callersFunctionget_model_and_tokenizer_class
(args)
LAMA/p_tuning/models.py:18
↓ 1 callersMethodget_parts
Given an input example, apply a pattern to obtain two text sequences (text_a and text_b) containing exactly one mask token (or one co
PT-Fewshot/data_utils/task_pvps.py:193
↓ 1 callersMethodget_query
(self, x_h, prompt_tokens, x_t=None)
LAMA/p_tuning/modeling.py:74
↓ 1 callersFunctionget_task_args
()
LAMA/megatron_11b/megatron_wrapper.py:12
↓ 1 callersMethodget_task_name
(self)
LAMA/cli.py:142
↓ 1 callersMethodget_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:135
↓ 1 callersMethodget_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:129
↓ 1 callersMethodget_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:138
↓ 1 callersFunctionget_vocab
(model_name, strategy)
LAMA/data_utils/vocab.py:18
↓ 1 callersFunctioninit_model
Initialize a new model from the given config.
PT-Fewshot/pet/modeling.py:36
↓ 1 callersFunctioninit_vocab
(args)
LAMA/data_utils/vocab.py:5
↓ 1 callersMethodload
Load a list from a file
PT-Fewshot/pet/utils.py:51
↓ 1 callersFunctionload_megatron_lm
Load Megatron_lm in fp16. A Tesla V100 is enough for inference. I haven't implement the parallel method for fine-tuning. You can refer to
LAMA/megatron_11b/megatron_wrapper.py:17
↓ 1 callersFunctionload_pet_configs
Load the model, training and evaluation configs for PET from the given command line arguments.
PT-Fewshot/cli.py:34
↓ 1 callersFunctionmain
(relation_id=None)
LAMA/cli.py:224
↓ 1 callersFunctionmain
()
PT-Fewshot/cli.py:70
↓ 1 callersMethodpredict
(self, prev_output_tokens, inputs_embeds, attention_mask, labels, encoder_out=None, incrementa
LAMA/megatron_11b/models.py:69
↓ 1 callersMethodpretty_print
(self, tokenizer)
PT-Fewshot/pet/utils.py:141
↓ 1 callersFunctionset_seed
(args)
LAMA/cli.py:24
↓ 1 callersFunctionset_seed
Set RNG seeds for python's `random` module, numpy and torch
PT-Fewshot/pet/utils.py:190
↓ 1 callersMethodto_dict
Serialize this instance to a Python dictionary.
PT-Fewshot/pet/utils.py:90
↓ 1 callersMethodto_dict
Serialize this instance to a Python dictionary.
PT-Fewshot/pet/utils.py:150
↓ 1 callersMethodto_json_string
Serialize this instance to a JSON string.
PT-Fewshot/pet/utils.py:95
↓ 1 callersMethodto_json_string
Serialize this instance to a JSON string.
PT-Fewshot/pet/utils.py:155
↓ 1 callersMethodto_list
(self)
PT-Fewshot/data_utils/task_processors.py:87
↓ 1 callersMethodtrain
(self)
LAMA/cli.py:174
↓ 1 callersMethodtrain
Train the underlying language model. :param train_data: the training examples to use :param per_gpu_train_batch_size: the nu
PT-Fewshot/pet/wrapper.py:235
↓ 1 callersFunctiontrain_pet
Train and evaluate a new PET model for a given task. :param model_config: the model configuration for each model corresponding to an individ
PT-Fewshot/pet/modeling.py:43
↓ 1 callersFunctiontrain_single_model
Train a single model. :param model: the model to train :param train_data: the training examples to use :param config: the training co
PT-Fewshot/pet/modeling.py:157
↓ 1 callersMethodtrain_step
Custom implementation of the train step for this task. :param batch: a batch of examples :return: a scalar loss tensor
PT-Fewshot/pet/task_helpers.py:42
↓ 1 callersFunctiontrim_input_ids
Trim a sequence of input ids by removing all padding tokens and keeping at most a specific number of mask tokens. :param input_ids: the seque
PT-Fewshot/pet/utils.py:287
↓ 1 callersMethodtruncate
Truncate two sequences of text to a predefined total maximum length
PT-Fewshot/data_utils/task_pvps.py:176
Method__getitem__
(self, i)
LAMA/data_utils/dataset.py:34
Method__getitem__
(self, index)
PT-Fewshot/pet/utils.py:183
Method__init__
(self, args)
LAMA/cli.py:80
Method__init__
(self, args, dictionary, embed_tokens, no_encoder_attn=False)
LAMA/megatron_11b/models.py:65
next →1–100 of 222, ranked by callers