摘要: 1. bert为什么attention除以根号下d 原因:因为点积的数量级增长很大,因此将 softmax 函数推向了梯度极小的区域。 案例: 在没有除以根号d时, raw_tensor = torch.tensor([[2.1,3.3,0.5,-2.7]]) torch.softmax(raw_t 阅读全文
posted @ 2023-06-16 14:06 15375357604 阅读(119) 评论(0) 推荐(0) 编辑
摘要: transformer中的模型分类: bert(自编码)、gpt(自回归)、bart(编码-解码) hidden_size (d) = num_attention_heads (m) * attention_head_size (a),也即 d=m*a, d为transformer模型输出的维度,这 阅读全文
posted @ 2023-06-16 09:58 15375357604 阅读(32) 评论(0) 推荐(0) 编辑