查看分析网络层次
1.剔除中間并列的元素,只保留一個元素
2.從里層配對括號開始標記
3.標記層次 配對的括號 標上相同的符號
<bound method BertPreTrainedModel.init_bert_weights of BertForTokenClassification(
(bert): 第一層BertModel(
(embeddings):第二層 BertEmbeddings(
(word_embeddings):
)
(encoder):第二層 BertEncoder(
(layer): ModuleList(
(0): BertLayer(
(attention): BertAttention(
(self): BertSelfAttention(
(query):
)
(output): BertSelfOutput(
(dense):
)
)BertAttention
(intermediate): BertIntermediate(
(dense):
)BertIntermediate
(output): BertOutput(
(dense):
) BertOutput
)BertLayer
分離
)ModuleList
)BertEncoder
第二層(pooler): BertPooler(
(dense):
)BertPooler
)BertModel
第一層(dropout): Dropout(p=0.1)
第一層(classifier): Linear(in_features=768, out_features=39, bias=True)
)>
以上是bert 模型的結構
1.最外層 先經過bertmodel,然后是droput,最后是classifier 分類器
2.第二層 對于 bertmodel,組成部分是 BertEmbeddings,BertEncoder,BertPooler
3.第三層是對于上面三個組成部分的再深入比如 bertEncoder 里面組成部分是 BertLayer
4.第四層BertLayer 里面的組成成分BertAttention,BertIntermediate, BertOutput
5.所有的BertLayer 在list 相當于是串聯的方式組成的
總結
- 上一篇: python pycharm 包 安装问
- 下一篇: PyTorch的torch.cat