Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

前端构图API #69

Closed
wants to merge 8 commits into from
Closed

前端构图API #69

wants to merge 8 commits into from

Conversation

PanZezhong1725
Copy link
Contributor

No description provided.

@YdrMaster
Copy link
Collaborator

比较多文件缺少尾随空行


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
Collaborator

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
Collaborator

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
Collaborator

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