Skip to content

Conversation

@sageyou
Copy link
Collaborator

@sageyou sageyou commented Oct 23, 2023

Thank you for your contribution to the MindCV repo.
Before submitting this PR, please make sure:

@sageyou sageyou force-pushed the add_vit_sam branch 5 times, most recently from e144a2e to 76a9170 Compare October 24, 2023 03:51
Copy link
Contributor

@geniuspatrick geniuspatrick left a comment

Choose a reason for hiding this comment

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

pyproject.toml的13行注释掉,重新对这个文件跑一下pre-commit

self.num_prefix_tokens = num_prefix_tokens # exclude CLS token (or other prefix tokens)
self.ordered = ordered
self.return_indices = return_indices
self.sort = ops.Sort()
Copy link
Contributor

Choose a reason for hiding this comment

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

直接在前向里用函数式接口

self.return_indices = return_indices
self.sort = ops.Sort()

def forward(self, x):
Copy link
Contributor

Choose a reason for hiding this comment

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

construct

Comment on lines 89 to 90
x = ops.Reshape()(x, (B, self.embed_dim, -1)) # B Ph*Pw C
x = ops.Transpose()(x, (0, 2, 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

用函数式接口

Comment on lines 87 to 89
self.mul = ops.Mul()
self.reshape = ops.Reshape()
self.transpose = ops.Transpose()
self.unstack = ops.Unstack(axis=0)
self.attn_matmul_v = ops.BatchMatMul()
self.q_matmul_k = ops.BatchMatMul(transpose_b=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

尽量替换为函数式接口

"""Multi-head Attention block with relative position embeddings."""

def __init__(
self,
Copy link
Contributor

Choose a reason for hiding this comment

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

减少一级缩进



def get_decomposed_rel_pos(
q: ms.Tensor,
Copy link
Contributor

Choose a reason for hiding this comment

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

减少一级缩进

@sageyou sageyou force-pushed the add_vit_sam branch 5 times, most recently from 1279c2d to 10cd680 Compare October 28, 2023 07:50
@vigo999 vigo999 self-requested a review March 8, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants