Working Content:
1. 这几天找到了提取attention层的代码,并且可以实现可视化:https://github.com/luo3300612/Visualizer
效果图大概是这样:
用这段代码调用函数,attention_maps[3][0,4,:,:]指的是第3层attention层的第4个注意力头的注意力分数。
visualize_grid_to_grid_with_cls(attention_maps[3][0,4,:,:], 105, image)
标签:Log,20230703,attention,maps,grid,SummerResearch From: https://www.cnblogs.com/Hexh/p/17523014.html