MCPcopy Create free account

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

Functions222 in github.com/THUDM/P-tuning

Method__init__
(self, args, device, template)
LAMA/p_tuning/modeling.py:17
Method__init__
(self, template, hidden_size, tokenizer, device, args)
LAMA/p_tuning/prompt_encoder.py:6
Method__init__
(self, dataset_type, data, tokenizer, args)
LAMA/data_utils/dataset.py:16
Method__init__
Create a new training config. :param device: the device to use ('cpu' or 'gpu') :param per_gpu_train_batch_size: the number
PT-Fewshot/pet/config.py:29
Method__init__
Create a new evaluation config. :param device: the device to use ('cpu' or 'gpu') :param n_gpu: the number of gpus to use
PT-Fewshot/pet/config.py:75
Method__init__
(self, model_type: str, model_name_or_path: str, task_name:
PT-Fewshot/pet/config.py:98
Method__init__
Create a new preprocessor. :param wrapper: the wrapper for the language model to use :param task_name: the name of the task
PT-Fewshot/pet/preprocessor.py:24
Method__init__
Create a new InputExample. :param guid: a unique textual identifier :param text_a: the sequence of text :param text_b
PT-Fewshot/pet/utils.py:68
Method__init__
Create new InputFeatures. :param input_ids: the input ids corresponding to the original text or text sequence :param attentio
PT-Fewshot/pet/utils.py:115
Method__init__
(self, *_, perm_mask, target_mapping, **kwargs)
PT-Fewshot/pet/utils.py:163
Method__init__
(self, **tensors)
PT-Fewshot/pet/utils.py:177
Method__init__
(self, wrapper)
PT-Fewshot/pet/task_helpers.py:188
Method__init__
(self, config:WrapperConfig, tokenizer)
PT-Fewshot/pet/wrapper.py:83
Method__init__
(self, config: WrapperConfig)
PT-Fewshot/pet/wrapper.py:141
Method__init__
Implementation of a list that stores only a limited amount of examples per label. :param labels: the set of all possible labels
PT-Fewshot/data_utils/task_processors.py:48
Method__init__
Create a new PVP. :param wrapper: the wrapper for the underlying language model :param pattern_id: the pattern id to use
PT-Fewshot/data_utils/task_pvps.py:40
Method__len__
(self)
LAMA/data_utils/dataset.py:31
Method__len__
(self)
PT-Fewshot/pet/utils.py:186
Method__repr__
(self)
PT-Fewshot/pet/config.py:9
Method__repr__
(self)
PT-Fewshot/pet/utils.py:40
Method__repr__
(self)
PT-Fewshot/pet/utils.py:87
Method__repr__
(self)
PT-Fewshot/pet/utils.py:138
Method_load_verbalizer_from_file
(path: str, pattern_id: int)
PT-Fewshot/data_utils/task_pvps.py:247
Methodadd_features_to_dict
(self, features: List[InputFeatures], feature_dict: Dict[str, torch.Tensor])
PT-Fewshot/pet/task_helpers.py:92
Methodadd_features_to_dict
(self, features: List[InputFeatures], feature_dict: Dict[str, torch.Tensor])
PT-Fewshot/pet/task_helpers.py:177
Methodadd_features_to_dict
(self, features: List[InputFeatures], feature_dict: Dict[str, torch.Tensor])
PT-Fewshot/pet/task_helpers.py:209
Methodadd_special_input_features
(self, input_example: InputExample, input_features: InputFeatures)
PT-Fewshot/pet/task_helpers.py:89
Methodadd_special_input_features
(self, input_example: InputExample, input_features: InputFeatures)
PT-Fewshot/pet/task_helpers.py:166
Methodadd_special_input_features
(self, input_example: InputExample, input_features: InputFeatures)
PT-Fewshot/pet/task_helpers.py:193
Methodbert_out
()
LAMA/p_tuning/modeling.py:124
Functionchunks
Yield successive n-sized chunks from lst.
PT-Fewshot/pet/utils.py:204
Methodconvert_plm_logits_to_cls_logits
(self, logits: torch.Tensor)
PT-Fewshot/data_utils/task_pvps.py:240
Functiondistillation_loss
Compute the distillation loss (KL divergence between predictions and targets) as described in the PET paper
PT-Fewshot/pet/utils.py:335
Methodeval_step
(self, batch: Dict[str, torch.Tensor], decoding_strategy: str = 'default', **kwargs)
PT-Fewshot/pet/task_helpers.py:115
Methodeval_step
(self, batch: Dict[str, torch.Tensor], decoding_strategy: str = 'default', **kwargs)
PT-Fewshot/pet/task_helpers.py:227
Methodforward
(self, x_hs, x_ts, return_candidates=False)
LAMA/p_tuning/modeling.py:107
Methodforward
(self)
LAMA/p_tuning/prompt_encoder.py:37
Methodforward
(self, inputs_embeds=None, attention_mask=None, token_type_ids=None, labels=None)
PT-Fewshot/pet/wrapper.py:127
Methodget_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:107
Methodget_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:190
Methodget_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:230
Methodget_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:310
Methodget_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:349
Methodget_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:405
Methodget_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:465
Methodget_dev_examples
This method loads dev examples from a file with name `DEV_FILE_NAME` in the given directory. :param data_dir: the directory in which
PT-Fewshot/data_utils/custom_task_processor.py:67
Methodget_dev_examples
Get a collection of `InputExample`s for the dev set.
PT-Fewshot/data_utils/task_processors.py:102
Methodget_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:184
Methodget_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:224
Methodget_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:304
Methodget_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:343
Methodget_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:399
Methodget_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:456
Methodget_input_features
(self, example: InputExample, labelled: bool, priming: bool = False, **kwargs)
PT-Fewshot/pet/preprocessor.py:47
Methodget_labels
This method returns all possible labels for the task.
PT-Fewshot/data_utils/custom_task_processor.py:91
Methodget_labels
Get the list of labels for this data set.
PT-Fewshot/data_utils/task_processors.py:121
Methodget_labels
(self)
PT-Fewshot/data_utils/task_processors.py:144
Methodget_labels
(self)
PT-Fewshot/data_utils/task_processors.py:196
Methodget_labels
(self)
PT-Fewshot/data_utils/task_processors.py:236
Methodget_labels
(self)
PT-Fewshot/data_utils/task_processors.py:316
Methodget_labels
(self)
PT-Fewshot/data_utils/task_processors.py:355
Methodget_labels
(self)
PT-Fewshot/data_utils/task_processors.py:411
Methodget_labels
(self)
PT-Fewshot/data_utils/task_processors.py:468
Functionget_logger
(name: str)
PT-Fewshot/log.py:46
Methodget_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:275
Methodget_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:312
Methodget_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:343
Methodget_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:399
Methodget_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:458
Methodget_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:499
Methodget_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:527
Methodget_parts
This function defines the actual patterns: It takes as input an example and outputs the result of applying a pattern to it. To allow
PT-Fewshot/data_utils/custom_task_pvp.py:43
Methodget_sequence_classifier_inputs
Get the inputs for sequence classification. Override this method if the input for the task considered is of a more complicated form t
PT-Fewshot/pet/task_helpers.py:75
Methodget_test_examples
This method loads test examples from a file with name `TEST_FILE_NAME` in the given directory. :param data_dir: the directory in whic
PT-Fewshot/data_utils/custom_task_processor.py:75
Methodget_test_examples
Get a collection of `InputExample`s for the test set.
PT-Fewshot/data_utils/task_processors.py:111
Methodget_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:187
Methodget_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:227
Methodget_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:307
Methodget_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:346
Methodget_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:402
Methodget_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:459
Methodget_train_examples
This method loads train examples from a file with name `TRAIN_FILE_NAME` in the given directory. :param data_dir: the directory in wh
PT-Fewshot/data_utils/custom_task_processor.py:59
Methodget_train_examples
Get a collection of `InputExample`s for the train set.
PT-Fewshot/data_utils/task_processors.py:97
Methodget_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:181
Methodget_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:221
Methodget_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:301
Methodget_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:340
Methodget_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:396
Methodget_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:453
Methodget_unlabeled_examples
This method loads unlabeled examples from a file with name `UNLABELED_FILE_NAME` in the given directory. :param data_dir: the directo
PT-Fewshot/data_utils/custom_task_processor.py:83
Methodget_unlabeled_examples
Get a collection of `InputExample`s for the unlabeled set.
PT-Fewshot/data_utils/task_processors.py:116
Methodget_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:193
Methodget_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:233
Methodget_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:313
Methodget_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:352
Methodget_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:408
Methodget_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:462
Methodgpt_out
()
LAMA/p_tuning/modeling.py:149
Methodis_full
Return `true` iff no more examples can be added to this list
PT-Fewshot/data_utils/task_processors.py:66
Methodload_examples
Load a set of input examples from a file
PT-Fewshot/pet/utils.py:100
← previousnext →101–200 of 222, ranked by callers