code stringlengths 3 6.57k |
|---|
__init__(self, config) |
super() |
__init__() |
nn.ModuleList([BertLayer(config) |
range(config.num_hidden_layers) |
nn.ModuleList([BertHighway(config) |
range(config.num_hidden_layers) |
range(config.num_hidden_layers) |
set_early_exit_entropy(self, x) |
if (type(x) |
or (type(x) |
range(len(self.early_exit_entropy) |
init_highway_pooler(self, pooler) |
pooler.state_dict() |
highway.pooler.state_dict() |
items() |
param.copy_(loaded_model[name]) |
enumerate(self.layer) |
entropy(highway_logits) |
hidden_states(?) |
HighwayException(new_output, i + 1) |
exiting (DeeBERT) |
DeeBertModel(BertPreTrainedModel) |
__init__(self, config) |
super() |
__init__(config) |
BertEmbeddings(config) |
DeeBertEncoder(config) |
BertPooler(config) |
self.init_weights() |
init_highway_pooler(self) |
self.encoder.init_highway_pooler(self.pooler) |
get_input_embeddings(self) |
set_input_embeddings(self, value) |
_prune_heads(self, heads_to_prune) |
heads_to_prune.items() |
attention.prune_heads(heads) |
add_start_docstrings_to_model_forward(BERT_INPUTS_DOCSTRING) |
tuple(torch.FloatTensor) |
configuration (:class:`~transformers.BertConfig`) |
last_hidden_state (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, sequence_length, hidden_size) |
pooler_output (:obj:`torch.FloatTensor`: of shape :obj:`(batch_size, hidden_size) |
sequence (classification token) |
prediction (classification) |
hidden_states (:obj:`tuple(torch.FloatTensor) |
attentions (:obj:`tuple(torch.FloatTensor) |
highway_exits (:obj:`tuple(tuple(torch.Tensor) |
results (total length: number of layers) |
ValueError("You cannot specify both input_ids and inputs_embeds at the same time") |
input_ids.size() |
inputs_embeds.size() |
ValueError("You have to specify either input_ids or inputs_embeds") |
torch.ones(input_shape, device=device) |
torch.ones(input_shape, device=device) |
torch.zeros(input_shape, dtype=torch.long, device=device) |
self.get_extended_attention_mask(attention_mask, input_shape, device) |
encoder_attention_mask.dim() |
encoder_attention_mask.dim() |
next(self.parameters() |
self.get_head_mask(head_mask, self.config.num_hidden_layers) |
self.pooler(sequence_output) |
HighwayException(Exception) |
__init__(self, message, exit_layer) |
BertHighway(nn.Module) |
from (the output of one non-final BertLayer in BertEncoder) |
to (cross-entropy computation in BertForSequenceClassification) |
__init__(self, config) |
super() |
__init__() |
BertPooler(config) |
nn.Dropout(config.hidden_dropout_prob) |
nn.Linear(config.hidden_size, config.num_labels) |
forward(self, encoder_outputs) |
self.pooler(pooler_input) |
self.dropout(pooled_output) |
self.classifier(pooled_output) |
Model (with early exiting - DeeBERT) |
DeeBertForSequenceClassification(BertPreTrainedModel) |
__init__(self, config) |
super() |
__init__(config) |
DeeBertModel(config) |
nn.Dropout(config.hidden_dropout_prob) |
nn.Linear(config.hidden_size, self.config.num_labels) |
self.init_weights() |
add_start_docstrings_to_model_forward(BERT_INPUTS_DOCSTRING) |
labels (:obj:`torch.LongTensor` of shape :obj:`(batch_size,) |
computed (Mean-Square loss) |
computed (Cross-Entropy) |
tuple(torch.FloatTensor) |
configuration (:class:`~transformers.BertConfig`) |
loss (:obj:`torch.FloatTensor` of shape :obj:`(1,) |
Classification (or regression if config.num_labels==1) |
logits (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, config.num_labels) |
Classification (or regression if config.num_labels==1) |
scores (before SoftMax) |
hidden_states (:obj:`tuple(torch.FloatTensor) |
attentions (:obj:`tuple(torch.FloatTensor) |
highway_exits (:obj:`tuple(tuple(torch.Tensor) |
results (total length: number of layers) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.