MCPcopy Create free account

hub / github.com/IBM/PoWER-BERT / functions

Functions84 in github.com/IBM/PoWER-BERT

↓ 43 callersMethodconvert_to_unicode
Converts `text` to Unicode (if it's not already), assuming utf-8 input.
utils/data_parser.py:45
↓ 8 callersMethod_read_tsv
Reads a tab separated value file.
utils/data_parser.py:34
↓ 8 callersMethodencode
(self, first, second=None, max_len=None)
utils/data_parser.py:66
↓ 6 callersFunctionbuild_model_from_config
Build the model from config file. :param config_file: The path to the JSON configuration file. :param training: If training, the whole model w
model/checkpoint_loader.py:143
↓ 6 callersFunctioncalc_train_steps
Calculate the number of total and warmup steps. >>> calc_train_steps(num_example=1024, batch_size=32, epochs=10, warmup_proportion=0.1) (320,
utils/Adam_mult.py:15
↓ 3 callersMethod_reshape_mask
(mask, head_num)
model/multi_head_attention.py:173
↓ 3 callersMethod_reshape_to_batches
(x, head_num)
model/multi_head_attention.py:156
↓ 3 callersFunctionload_checkpoint
Load trained official model from checkpoint. :param model: Built keras model. :param config: Loaded configuration file. :param
model/checkpoint_loader.py:193
↓ 3 callersMethodload_data
(self, data_path, set_type=None)
utils/data_parser.py:103
↓ 3 callersFunctionload_model
Load trained official model from checkpoint. :param config_file: The path to the JSON configuration file. :param checkpoint_file: The path to
model/checkpoint_loader.py:262
↓ 2 callersFunction_wrap_layer
Wrap layers with residual, normalization and dropout. :param name: Prefix of names for internal layers. :param input_layer: Input lay
model/model.py:153
↓ 2 callersMethodget_dev_data
(self)
utils/data_parser.py:90
↓ 2 callersFunctionretention_config_parser
Parse the retention configuration provided by the user. Also, check the provided rentention config for correctness.
utils/retention_parser.py:4
↓ 1 callersMethod__init__
(self, atten=None, kernel_initializer='glorot_normal', kerne
model/model.py:49
↓ 1 callersMethod_reshape_from_batches
(x, head_num)
model/multi_head_attention.py:165
↓ 1 callersFunction_trainable
(_layer)
model/checkpoint_loader.py:70
↓ 1 callersMethodatten_col
(self, avg_atten)
model/model.py:80
↓ 1 callersMethodatten_col
(self, avg_atten)
model/model.py:133
↓ 1 callersFunctionattention_builder
Get multi-head self-attention builder. :param name: Prefix of names for internal layers. :param head_num: Number of heads in multi-head self-
model/model.py:224
↓ 1 callersMethodcalc_avg_atten
(self, x, head_num)
model/model.py:72
↓ 1 callersMethodcalc_avg_atten
(self, x, head_num)
model/model.py:125
↓ 1 callersFunctioncheckpoint_loader
(checkpoint_file)
model/checkpoint_loader.py:137
↓ 1 callersMethodcompute_output_shape
(self, input_shape)
model/multi_head_attention.py:74
↓ 1 callersMethodconfiguration_search_step
Searches for a good output reduction configuration on given model and data. lambda_hyperparam: See the paper for the mean
training.py:117
↓ 1 callersFunctioneval
(args, dev_x, dev_y, num_layers, num_classes, seq_len)
evaluation.py:9
↓ 1 callersFunctionfeed_forward_builder
Get position-wise feed-forward layer builder. :param name: Prefix of names for internal layers. :param hidden_dim: Hidden dimension of feed f
model/model.py:250
↓ 1 callersMethodfine_tuning_step
Carries out simple fine-tuning for the data given in train_data above. Use it only if the model at checkpoint path has never
training.py:63
↓ 1 callersFunctionget_checkpoint_model
Get BERT model. :param token_num: Number of tokens. :param pos_num: Maximum position. :param seq_len: Maximum length of the in
model/checkpoint_loader.py:28
↓ 1 callersMethodget_configuration
Computes the retention config given a trained model with soft extract layers. Args: configuration_search_mode
training.py:192
↓ 1 callersFunctionget_encoder_component
Multi-head self-attention and feed-forward layer. :param name: Prefix of names for internal layers. :param input_layer: Input layer. :par
model/model.py:272
↓ 1 callersFunctionget_encoders
Get encoders. :param encoder_num: Number of encoder components. :param input_layer: Input layer. :param head_num: Number of heads in mult
model/model.py:355
↓ 1 callersMethodget_test_data
(self)
utils/data_parser.py:96
↓ 1 callersMethodget_train_data
(self)
utils/data_parser.py:84
↓ 1 callersMethodload_data_cola
(self, path, SEQ_LEN=None, set_type='train')
utils/data_parser.py:289
↓ 1 callersMethodload_data_mnli
(self, path, set_type='train')
utils/data_parser.py:317
↓ 1 callersMethodload_data_mrpc
(self, path, set_type='train')
utils/data_parser.py:190
↓ 1 callersMethodload_data_qnli
(self, path, set_type='train')
utils/data_parser.py:222
↓ 1 callersMethodload_data_qqp
(self, path, set_type='train')
utils/data_parser.py:128
↓ 1 callersMethodload_data_rte
(self, path, set_type='train')
utils/data_parser.py:256
↓ 1 callersMethodload_data_sst
(self, path, set_type='train')
utils/data_parser.py:162
↓ 1 callersMethodload_data_stsb
(self, path, set_type='train')
utils/data_parser.py:349
↓ 1 callersFunctionpredict
(args, test_x, num_layers, num_classes, seq_len)
prediction.py:38
↓ 1 callersMethodretraining_step
Switches Soft Extract layer to a Hard Extract layer and trains on the given data. Args: configuration_search_
training.py:219
↓ 1 callersFunctionsave_pred_glue
(predict, test_x, test_y, TASK=None, OUTPUT_DIR=None)
prediction.py:10
Method__call__
(self, w)
model/model.py:28
Method__call__
(self, w)
model/model.py:40
Method__init__
Makes an instance of training. Args: dev_data: The entire validation data. train_data: The en
training.py:17
Method__init__
(self, VOCAB_PATH=None, TASK=None, SEQ_LEN=Non
utils/data_parser.py:13
Method__init__
(self, decay_steps, warmup_steps, min_lr=0.0, learning_rate=0.001, beta_1=0.9, beta_2=0.999,
utils/Adam_mult.py:49
Method__init__
Initialize the layer. :param return_attention: Whether to return attention weights. :param history_only: Whether to only use history data. :par
model/scaled_dot_attention.py:18
Method__init__
Initialize the layer. :param head_num: Number of heads. :param activation: Activations for linear mappings. :param use_bias: Whether to use b
model/multi_head_attention.py:15
Method__init__
(self, min, max)
model/model.py:36
Method__init__
(self, index=None, atten=None, attention_mask=None, **kwargs)
model/model.py:112
Function_attention_builder
(x)
model/model.py:239
Function_feed_forward_builder
(x)
model/model.py:262
Function_loader
(name)
model/checkpoint_loader.py:138
Methodbuild
(self, input_shape)
model/multi_head_attention.py:85
Methodbuild
(self, input_shape)
model/model.py:86
Methodcall
(self, inputs, mask=None, **kwargs)
model/scaled_dot_attention.py:60
Methodcall
(self, inputs, mask=None)
model/multi_head_attention.py:181
Methodcall
(self, x, mask=None)
model/model.py:98
Methodcall
(self, x, mask=None)
model/model.py:139
Methodcompute_mask
(self, inputs, mask=None)
model/scaled_dot_attention.py:53
Methodcompute_mask
(self, inputs, input_mask=None)
model/multi_head_attention.py:80
Methodcompute_mask
(self, inputs, mask=None)
model/model.py:69
Methodcompute_mask
(self, inputs, mask=None)
model/model.py:122
Methodcompute_output_shape
(self, input_shape)
model/scaled_dot_attention.py:42
Methodcompute_output_shape
(self, input_shape)
model/model.py:66
Methodcompute_output_shape
(self, input_shape)
model/model.py:118
Functiongelu_fallback
(x)
model/checkpoint_loader.py:17
Functiongelu_tensorflow
(x)
model/checkpoint_loader.py:12
Methodget_config
(self)
utils/Adam_mult.py:142
Methodget_config
(self)
model/scaled_dot_attention.py:34
Methodget_config
(self)
model/multi_head_attention.py:58
Methodget_config
(self)
model/model.py:31
Methodget_config
(self)
model/model.py:44
Functionget_custom_objects
()
model/model.py:19
Methodget_updates
(self, loss, params)
utils/Adam_mult.py:81
Functionidentity
(x)
utils/Adam_mult.py:7
Methodlr
(self)
utils/Adam_mult.py:73
Functionmetric_cor
(y_true, y_pred)
utils/mean_squared_error.py:4
Methodtest_finetuned_model
Test code for finetuning task.
test/test_model.py:16
Methodtest_retrained_model
Test code for retrained model.
test/test_model.py:72
Methodtest_search_model
Test code for configurtion search.
test/test_model.py:44