Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/chenxiaoyouyou/Bert-BiLSTM-CRF-pytorch
/ functions
Functions
21 in github.com/chenxiaoyouyou/Bert-BiLSTM-CRF-pytorch
⨍
Functions
21
◇
Types & classes
4
↓ 2 callers
Function
load_vocab
Loads a vocabulary file into a dictionary.
utils.py:15
↓ 2 callers
Function
log_sum_exp
Args: vec: size=(batch_size, vanishing_dim, hidden_dim) m_size: hidden_dim Returns: size=(batch_size, hidden_dim)
model/crf.py:9
↓ 2 callers
Method
loss
feats: size=(batch_size, seq_len, tag_size) mask: size=(batch_size, seq_len) tags: size=(batch_size, seq_len)
model/bert_lstm_crf.py:58
↓ 2 callers
Function
read_corpus
:param path:数据文件路径 :param max_length: 最大长度 :param label_dic: 标签字典 :return:
utils.py:30
↓ 2 callers
Method
update
(self, **kwargs)
config.py:30
↓ 1 callers
Method
_forward_alg
Do the forward algorithm to compute the partition function (batched). Args: feats: size=(batch_size, seq_len, self.targe
model/crf.py:44
↓ 1 callers
Method
_score_sentence
Args: scores: size=(seq_len, batch_size, tag_size, tag_size) mask: size=(batch_size, seq_len) tags: size=
model/crf.py:174
↓ 1 callers
Method
_viterbi_decode
Args: feats: size=(batch_size, seq_len, self.target_size+2) mask: size=(batch_size, seq_len) Returns:
model/crf.py:90
↓ 1 callers
Function
dev
(model, dev_loader, epoch, config)
main.py:70
↓ 1 callers
Function
load_model
(model, path='result', **kwargs)
utils.py:88
↓ 1 callers
Method
neg_log_likelihood_loss
Args: feats: size=(batch_size, seq_len, tag_size) mask: size=(batch_size, seq_len) tags: size=(batch_size
model/crf.py:213
↓ 1 callers
Method
rand_init_hidden
random initialize hidden variable
model/bert_lstm_crf.py:28
↓ 1 callers
Function
save_model
默认保留所有模型 :param model: 模型 :param path: 保存路径 :param loss: 校验损失 :param last_loss: 最佳epoch损失 :param kwargs: every_epoch or best_
utils.py:65
Method
__init__
(self)
config.py:5
Method
__init__
(self, input_id, label_id, input_mask)
utils.py:9
Method
__init__
Args: target_size: int, target size use_cuda: bool, 是否使用gpu, default is True average_batch: bool, loss是否作
model/crf.py:26
Method
__init__
(self, bert_config, tagset_size, embedding_dim, hidden_dim, rnn_layers, dropout_ratio, dropout1, use_cuda=Fals
model/bert_lstm_crf.py:15
Method
__str__
(self)
config.py:34
Method
forward
(self, feats, mask=None)
model/crf.py:170
Method
forward
args: sentence (word_seq_len, batch_size) : word-level representation of sentence hidden: initial hidden state
model/bert_lstm_crf.py:36
Function
train
(**kwargs)
main.py:14