Unverified Commit 183ce067 authored by novice's avatar novice Committed by GitHub
Browse files

Fix (#15276)

* Fix

* make style

* Remove trailing commas

* make style
parent b4ce313e
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
# rely on isort to merge the imports # rely on isort to merge the imports
from ...file_utils import _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available from ...file_utils import _LazyModule, is_torch_available
_import_structure = { _import_structure = {
......
...@@ -53,7 +53,7 @@ class SwinConfig(PretrainedConfig): ...@@ -53,7 +53,7 @@ class SwinConfig(PretrainedConfig):
window_size (`int`, *optional*, defaults to 7): window_size (`int`, *optional*, defaults to 7):
Size of windows. Size of windows.
mlp_ratio (`float`, *optional*, defaults to 4.0): mlp_ratio (`float`, *optional*, defaults to 4.0):
Ratio of MLP hidden dimesionality to embedding dimensionality. Ratio of MLP hidden dimensionality to embedding dimensionality.
qkv_bias (`bool`, *optional*, defaults to True): qkv_bias (`bool`, *optional*, defaults to True):
Whether or not a learnable bias should be added to the queries, keys and values. Whether or not a learnable bias should be added to the queries, keys and values.
hidden_dropout_prob (`float`, *optional*, defaults to 0.0): hidden_dropout_prob (`float`, *optional*, defaults to 0.0):
......
...@@ -583,20 +583,10 @@ class SwinEncoder(nn.Module): ...@@ -583,20 +583,10 @@ class SwinEncoder(nn.Module):
all_hidden_states = all_hidden_states + (hidden_states,) all_hidden_states = all_hidden_states + (hidden_states,)
if not return_dict: if not return_dict:
return tuple( return tuple(v for v in [hidden_states, all_hidden_states, all_self_attentions] if v is not None)
v
for v in [
hidden_states,
all_hidden_states,
all_self_attentions,
]
if v is not None
)
return BaseModelOutput( return BaseModelOutput(
last_hidden_state=hidden_states, last_hidden_state=hidden_states, hidden_states=all_hidden_states, attentions=all_self_attentions
hidden_states=all_hidden_states,
attentions=all_self_attentions,
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment