2022-06-30 71399647295cde385c2492cf139c727c 99+ fast 0.1 kbertviz:attention可视化工具看不同layer,不同head的attention 注意: 12345678910111213141516from bertviz.neuron_view import showfrom bertviz.transformers_neuron_view import BertModel, BertTokenizermodel1=BertModel.from_pretrained(path)model_type = 'bert'show(model1, model_type, tokenizer, sentence_a, sentence_b, layer=4, head=3)可以###########################from bertviz.neuron_view import showfrom transformers import BertTokenizer, BertModelmodel1=BertModel.from_pretrained(path)model_type = 'bert'show(model1, model_type, tokenizer, sentence_a, sentence_b, layer=4, head=3)报错 参考https://zhuanlan.zhihu.com/p/457043243 NLP 小帮手 bertviz:attention可视化工具