拥抱面Tfrobertamodel详细摘要
from transformers import RobertaTokenizer, TFRobertaModel
import tensorflow as tf
tokenizer = RobertaTokenizer.from_pretrained("roberta-base")
model = TFRobertaModel.from_pretrained("roberta-base")
我想要此huggingface tfrobertamodel()
的详细层摘要,以便我可以在需要时可视化形状,层和自定义。但是,当我这样做时: model.summary()
,它只是单层显示所有内容。我尝试挖掘它的不同属性,但无法获得详细的层摘要。可以这样做吗?
Model: "tf_roberta_model_2"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
roberta (TFRobertaMainLayer) multiple 124645632
=================================================================
Total params: 124,645,632
Trainable params: 124,645,632
Non-trainable params: 0
_________________________________________________________________
另外,还有一个相关的问题< /a>在尚未回答的拥抱面论坛中。
from transformers import RobertaTokenizer, TFRobertaModel
import tensorflow as tf
tokenizer = RobertaTokenizer.from_pretrained("roberta-base")
model = TFRobertaModel.from_pretrained("roberta-base")
I want a detailed layer summary of this HuggingFace TFRobertaModel()
so that I can visualize shapes, layers and customize if needed. However, when I did:model.summary()
, it just shows everything in a single layer. I tried digging into it's different attributes, but not able to get a detailed layer summary. Is it possible to do so?
Model: "tf_roberta_model_2"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
roberta (TFRobertaMainLayer) multiple 124645632
=================================================================
Total params: 124,645,632
Trainable params: 124,645,632
Non-trainable params: 0
_________________________________________________________________
Also, there is a related question in HuggingFace forum which hasn't been answered yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不完全是模型摘要,但是您可以打印这样的层:
您也可以使用
s. weager
来获取每一层的权重。Not exactly a model summary, but you can print the layers like this:
You could also use
s.weights
to get the weights of each layer.