ductai199x
commited on
Commit
•
04d50b0
1
Parent(s):
c2e7f35
fix bug
Browse files- modeling_sam_hq.py +2 -3
modeling_sam_hq.py
CHANGED
@@ -1152,9 +1152,6 @@ class SamVisionEncoder(nn.Module):
|
|
1152 |
all_self_attentions = () if output_attentions else None
|
1153 |
|
1154 |
for i, layer_module in enumerate(self.layers):
|
1155 |
-
if output_hidden_states:
|
1156 |
-
all_hidden_states = all_hidden_states + (hidden_states,)
|
1157 |
-
|
1158 |
if self.gradient_checkpointing and self.training:
|
1159 |
layer_outputs = self._gradient_checkpointing_func(
|
1160 |
layer_module.__call__,
|
@@ -1164,6 +1161,8 @@ class SamVisionEncoder(nn.Module):
|
|
1164 |
layer_outputs = layer_module(hidden_states, output_attentions=output_attentions)
|
1165 |
|
1166 |
hidden_states = layer_outputs[0]
|
|
|
|
|
1167 |
|
1168 |
if output_attentions:
|
1169 |
all_self_attentions = all_self_attentions + (layer_outputs[1],)
|
|
|
1152 |
all_self_attentions = () if output_attentions else None
|
1153 |
|
1154 |
for i, layer_module in enumerate(self.layers):
|
|
|
|
|
|
|
1155 |
if self.gradient_checkpointing and self.training:
|
1156 |
layer_outputs = self._gradient_checkpointing_func(
|
1157 |
layer_module.__call__,
|
|
|
1161 |
layer_outputs = layer_module(hidden_states, output_attentions=output_attentions)
|
1162 |
|
1163 |
hidden_states = layer_outputs[0]
|
1164 |
+
if output_hidden_states and layer_module.window_size == 0:
|
1165 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
1166 |
|
1167 |
if output_attentions:
|
1168 |
all_self_attentions = all_self_attentions + (layer_outputs[1],)
|