Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/THUDM/P-tuning
/ functions
Functions
222 in github.com/THUDM/P-tuning
⨍
Functions
222
◇
Types & classes
43
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
Method
add_features_to_dict
(self, features: List[InputFeatures], feature_dict: Dict[str, torch.Tensor])
PT-Fewshot/pet/task_helpers.py:92
Method
add_features_to_dict
(self, features: List[InputFeatures], feature_dict: Dict[str, torch.Tensor])
PT-Fewshot/pet/task_helpers.py:177
Method
add_features_to_dict
(self, features: List[InputFeatures], feature_dict: Dict[str, torch.Tensor])
PT-Fewshot/pet/task_helpers.py:209
Method
add_special_input_features
(self, input_example: InputExample, input_features: InputFeatures)
PT-Fewshot/pet/task_helpers.py:89
Method
add_special_input_features
(self, input_example: InputExample, input_features: InputFeatures)
PT-Fewshot/pet/task_helpers.py:166
Method
add_special_input_features
(self, input_example: InputExample, input_features: InputFeatures)
PT-Fewshot/pet/task_helpers.py:193
Method
bert_out
()
LAMA/p_tuning/modeling.py:124
Function
chunks
Yield successive n-sized chunks from lst.
PT-Fewshot/pet/utils.py:204
Method
convert_plm_logits_to_cls_logits
(self, logits: torch.Tensor)
PT-Fewshot/data_utils/task_pvps.py:240
Function
distillation_loss
Compute the distillation loss (KL divergence between predictions and targets) as described in the PET paper
PT-Fewshot/pet/utils.py:335
Method
eval_step
(self, batch: Dict[str, torch.Tensor], decoding_strategy: str = 'default', **kwargs)
PT-Fewshot/pet/task_helpers.py:115
Method
eval_step
(self, batch: Dict[str, torch.Tensor], decoding_strategy: str = 'default', **kwargs)
PT-Fewshot/pet/task_helpers.py:227
Method
forward
(self, x_hs, x_ts, return_candidates=False)
LAMA/p_tuning/modeling.py:107
Method
forward
(self)
LAMA/p_tuning/prompt_encoder.py:37
Method
forward
(self, inputs_embeds=None, attention_mask=None, token_type_ids=None, labels=None)
PT-Fewshot/pet/wrapper.py:127
Method
get_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:107
Method
get_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:190
Method
get_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:230
Method
get_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:310
Method
get_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:349
Method
get_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:405
Method
get_dev32_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:465
Method
get_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
Method
get_dev_examples
Get a collection of `InputExample`s for the dev set.
PT-Fewshot/data_utils/task_processors.py:102
Method
get_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:184
Method
get_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:224
Method
get_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:304
Method
get_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:343
Method
get_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:399
Method
get_dev_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:456
Method
get_input_features
(self, example: InputExample, labelled: bool, priming: bool = False, **kwargs)
PT-Fewshot/pet/preprocessor.py:47
Method
get_labels
This method returns all possible labels for the task.
PT-Fewshot/data_utils/custom_task_processor.py:91
Method
get_labels
Get the list of labels for this data set.
PT-Fewshot/data_utils/task_processors.py:121
Method
get_labels
(self)
PT-Fewshot/data_utils/task_processors.py:144
Method
get_labels
(self)
PT-Fewshot/data_utils/task_processors.py:196
Method
get_labels
(self)
PT-Fewshot/data_utils/task_processors.py:236
Method
get_labels
(self)
PT-Fewshot/data_utils/task_processors.py:316
Method
get_labels
(self)
PT-Fewshot/data_utils/task_processors.py:355
Method
get_labels
(self)
PT-Fewshot/data_utils/task_processors.py:411
Method
get_labels
(self)
PT-Fewshot/data_utils/task_processors.py:468
Function
get_logger
(name: str)
PT-Fewshot/log.py:46
Method
get_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:275
Method
get_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:312
Method
get_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:343
Method
get_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:399
Method
get_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:458
Method
get_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:499
Method
get_parts
(self, example: InputExample)
PT-Fewshot/data_utils/task_pvps.py:527
Method
get_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
Method
get_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
Method
get_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
Method
get_test_examples
Get a collection of `InputExample`s for the test set.
PT-Fewshot/data_utils/task_processors.py:111
Method
get_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:187
Method
get_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:227
Method
get_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:307
Method
get_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:346
Method
get_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:402
Method
get_test_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:459
Method
get_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
Method
get_train_examples
Get a collection of `InputExample`s for the train set.
PT-Fewshot/data_utils/task_processors.py:97
Method
get_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:181
Method
get_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:221
Method
get_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:301
Method
get_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:340
Method
get_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:396
Method
get_train_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:453
Method
get_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
Method
get_unlabeled_examples
Get a collection of `InputExample`s for the unlabeled set.
PT-Fewshot/data_utils/task_processors.py:116
Method
get_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:193
Method
get_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:233
Method
get_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:313
Method
get_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:352
Method
get_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:408
Method
get_unlabeled_examples
(self, data_dir)
PT-Fewshot/data_utils/task_processors.py:462
Method
gpt_out
()
LAMA/p_tuning/modeling.py:149
Method
is_full
Return `true` iff no more examples can be added to this list
PT-Fewshot/data_utils/task_processors.py:66
Method
load_examples
Load a set of input examples from a file
PT-Fewshot/pet/utils.py:100
← previous
next →
101–200 of 222, ranked by callers