From 6ec8560436159db49fa8d209267d6feaf6d8c43b Mon Sep 17 00:00:00 2001 From: Arun Date: Wed, 7 Aug 2024 11:35:46 +0530 Subject: [PATCH 1/2] Update hieradet.py Not used head_dim = dim_out // num_heads self.scale = head_dim**-0.5 F.scaled_dot_product_attention takes care of this automatically. --- sam2/modeling/backbones/hieradet.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sam2/modeling/backbones/hieradet.py b/sam2/modeling/backbones/hieradet.py index 1ae7d4c05..52051ffd5 100644 --- a/sam2/modeling/backbones/hieradet.py +++ b/sam2/modeling/backbones/hieradet.py @@ -46,11 +46,8 @@ def __init__( self.dim = dim self.dim_out = dim_out - self.num_heads = num_heads - head_dim = dim_out // num_heads - self.scale = head_dim**-0.5 - + self.q_pool = q_pool self.qkv = nn.Linear(dim, dim_out * 3) self.proj = nn.Linear(dim_out, dim_out) From 46945a2122e2f2fe735288dc257c4e43a2708a93 Mon Sep 17 00:00:00 2001 From: Arun Date: Fri, 9 Aug 2024 11:14:11 +0530 Subject: [PATCH 2/2] Update hieradet.py ufmt formatting fixed. --- sam2/modeling/backbones/hieradet.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sam2/modeling/backbones/hieradet.py b/sam2/modeling/backbones/hieradet.py index 52051ffd5..973d622fc 100644 --- a/sam2/modeling/backbones/hieradet.py +++ b/sam2/modeling/backbones/hieradet.py @@ -47,7 +47,6 @@ def __init__( self.dim = dim self.dim_out = dim_out self.num_heads = num_heads - self.q_pool = q_pool self.qkv = nn.Linear(dim, dim_out * 3) self.proj = nn.Linear(dim_out, dim_out)