Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/IBM/PoWER-BERT
/ functions
Functions
84 in github.com/IBM/PoWER-BERT
⨍
Functions
84
◇
Types & classes
10
↓ 43 callers
Method
convert_to_unicode
Converts `text` to Unicode (if it's not already), assuming utf-8 input.
utils/data_parser.py:45
↓ 8 callers
Method
_read_tsv
Reads a tab separated value file.
utils/data_parser.py:34
↓ 8 callers
Method
encode
(self, first, second=None, max_len=None)
utils/data_parser.py:66
↓ 6 callers
Function
build_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 callers
Function
calc_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 callers
Method
_reshape_mask
(mask, head_num)
model/multi_head_attention.py:173
↓ 3 callers
Method
_reshape_to_batches
(x, head_num)
model/multi_head_attention.py:156
↓ 3 callers
Function
load_checkpoint
Load trained official model from checkpoint. :param model: Built keras model. :param config: Loaded configuration file. :param
model/checkpoint_loader.py:193
↓ 3 callers
Method
load_data
(self, data_path, set_type=None)
utils/data_parser.py:103
↓ 3 callers
Function
load_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 callers
Function
_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 callers
Method
get_dev_data
(self)
utils/data_parser.py:90
↓ 2 callers
Function
retention_config_parser
Parse the retention configuration provided by the user. Also, check the provided rentention config for correctness.
utils/retention_parser.py:4
↓ 1 callers
Method
__init__
(self, atten=None, kernel_initializer='glorot_normal', kerne
model/model.py:49
↓ 1 callers
Method
_reshape_from_batches
(x, head_num)
model/multi_head_attention.py:165
↓ 1 callers
Function
_trainable
(_layer)
model/checkpoint_loader.py:70
↓ 1 callers
Method
atten_col
(self, avg_atten)
model/model.py:80
↓ 1 callers
Method
atten_col
(self, avg_atten)
model/model.py:133
↓ 1 callers
Function
attention_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 callers
Method
calc_avg_atten
(self, x, head_num)
model/model.py:72
↓ 1 callers
Method
calc_avg_atten
(self, x, head_num)
model/model.py:125
↓ 1 callers
Function
checkpoint_loader
(checkpoint_file)
model/checkpoint_loader.py:137
↓ 1 callers
Method
compute_output_shape
(self, input_shape)
model/multi_head_attention.py:74
↓ 1 callers
Method
configuration_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 callers
Function
eval
(args, dev_x, dev_y, num_layers, num_classes, seq_len)
evaluation.py:9
↓ 1 callers
Function
feed_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 callers
Method
fine_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 callers
Function
get_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 callers
Method
get_configuration
Computes the retention config given a trained model with soft extract layers. Args: configuration_search_mode
training.py:192
↓ 1 callers
Function
get_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 callers
Function
get_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 callers
Method
get_test_data
(self)
utils/data_parser.py:96
↓ 1 callers
Method
get_train_data
(self)
utils/data_parser.py:84
↓ 1 callers
Method
load_data_cola
(self, path, SEQ_LEN=None, set_type='train')
utils/data_parser.py:289
↓ 1 callers
Method
load_data_mnli
(self, path, set_type='train')
utils/data_parser.py:317
↓ 1 callers
Method
load_data_mrpc
(self, path, set_type='train')
utils/data_parser.py:190
↓ 1 callers
Method
load_data_qnli
(self, path, set_type='train')
utils/data_parser.py:222
↓ 1 callers
Method
load_data_qqp
(self, path, set_type='train')
utils/data_parser.py:128
↓ 1 callers
Method
load_data_rte
(self, path, set_type='train')
utils/data_parser.py:256
↓ 1 callers
Method
load_data_sst
(self, path, set_type='train')
utils/data_parser.py:162
↓ 1 callers
Method
load_data_stsb
(self, path, set_type='train')
utils/data_parser.py:349
↓ 1 callers
Function
predict
(args, test_x, num_layers, num_classes, seq_len)
prediction.py:38
↓ 1 callers
Method
retraining_step
Switches Soft Extract layer to a Hard Extract layer and trains on the given data. Args: configuration_search_
training.py:219
↓ 1 callers
Function
save_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
Method
build
(self, input_shape)
model/multi_head_attention.py:85
Method
build
(self, input_shape)
model/model.py:86
Method
call
(self, inputs, mask=None, **kwargs)
model/scaled_dot_attention.py:60
Method
call
(self, inputs, mask=None)
model/multi_head_attention.py:181
Method
call
(self, x, mask=None)
model/model.py:98
Method
call
(self, x, mask=None)
model/model.py:139
Method
compute_mask
(self, inputs, mask=None)
model/scaled_dot_attention.py:53
Method
compute_mask
(self, inputs, input_mask=None)
model/multi_head_attention.py:80
Method
compute_mask
(self, inputs, mask=None)
model/model.py:69
Method
compute_mask
(self, inputs, mask=None)
model/model.py:122
Method
compute_output_shape
(self, input_shape)
model/scaled_dot_attention.py:42
Method
compute_output_shape
(self, input_shape)
model/model.py:66
Method
compute_output_shape
(self, input_shape)
model/model.py:118
Function
gelu_fallback
(x)
model/checkpoint_loader.py:17
Function
gelu_tensorflow
(x)
model/checkpoint_loader.py:12
Method
get_config
(self)
utils/Adam_mult.py:142
Method
get_config
(self)
model/scaled_dot_attention.py:34
Method
get_config
(self)
model/multi_head_attention.py:58
Method
get_config
(self)
model/model.py:31
Method
get_config
(self)
model/model.py:44
Function
get_custom_objects
()
model/model.py:19
Method
get_updates
(self, loss, params)
utils/Adam_mult.py:81
Function
identity
(x)
utils/Adam_mult.py:7
Method
lr
(self)
utils/Adam_mult.py:73
Function
metric_cor
(y_true, y_pred)
utils/mean_squared_error.py:4
Method
test_finetuned_model
Test code for finetuning task.
test/test_model.py:16
Method
test_retrained_model
Test code for retrained model.
test/test_model.py:72
Method
test_search_model
Test code for configurtion search.
test/test_model.py:44