Skip to content

前端构图API#69

Closed
PanZezhong1725 wants to merge 8 commits intodevfrom
frontend-api
Closed

前端构图API#69
PanZezhong1725 wants to merge 8 commits intodevfrom
frontend-api

Conversation

@PanZezhong1725
Copy link
Contributor

No description provided.

@YdrMaster
Copy link
Contributor

比较多文件缺少尾随空行


key_states = self.transpose(key_states, [0, 1, 3, 2])
if self.num_kv_groups > 1:
attn_weights = self.matmul_group_k(query_states, key_states)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

实际上全部使用 group matmul 的逻辑就行了,reshape 不产生计算,没有开销

else:
attn_weights = self.matmul(query_states, key_states)

attn_weights = self.div(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么这个不是 gemm 的 α?

attn_weights = self.add(attn_weights, attention_mask)

if self.dtype != DTYPE.F32:
attn_weights = self.cast(attn_weights, DTYPE.F32)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里可以一直 cast,类型不变的 cast 会被跳过,不会计算

Base automatically changed from dev to master February 19, 2024 10:18
@YdrMaster YdrMaster changed the base branch from master to dev February 19, 2024 10:24
@PanZezhong1725
Copy link
Contributor Author

已转到独立repo:https://github.com/InfiniTensor/InfiniCanvas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants