Skip to content

Revert "Adding vit_h_14 architecture" #5259

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

Merged
merged 1 commit into from
Jan 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/source/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ You can construct a model with random weights by calling its constructor:
vit_b_32 = models.vit_b_32()
vit_l_16 = models.vit_l_16()
vit_l_32 = models.vit_l_32()
vit_h_14 = models.vit_h_14()

We provide pre-trained models, using the PyTorch :mod:`torch.utils.model_zoo`.
These can be constructed by passing ``pretrained=True``:
Expand Down Expand Up @@ -464,7 +463,6 @@ VisionTransformer
vit_b_32
vit_l_16
vit_l_32
vit_h_14

Quantized Models
----------------
Expand Down
1 change: 0 additions & 1 deletion hubconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,4 @@
vit_b_32,
vit_l_16,
vit_l_32,
vit_h_14,
)
Binary file removed test/expect/ModelTester.test_vit_h_14_expect.pkl
Binary file not shown.
21 changes: 0 additions & 21 deletions torchvision/models/vision_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"vit_b_32",
"vit_l_16",
"vit_l_32",
"vit_h_14",
]

model_urls = {
Expand Down Expand Up @@ -357,26 +356,6 @@ def vit_l_32(pretrained: bool = False, progress: bool = True, **kwargs: Any) ->
)


def vit_h_14(pretrained: bool = False, progress: bool = True, **kwargs: Any) -> VisionTransformer:
"""
Constructs a vit_h_14 architecture from
`"An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale" <https://arxiv.org/abs/2010.11929>`_.

NOTE: Pretrained weights are not available for this model.
"""
return _vision_transformer(
arch="vit_h_14",
patch_size=14,
num_layers=32,
num_heads=16,
hidden_dim=1280,
mlp_dim=5120,
pretrained=pretrained,
progress=progress,
**kwargs,
)


def interpolate_embeddings(
image_size: int,
patch_size: int,
Expand Down
23 changes: 0 additions & 23 deletions torchvision/prototype/models/vision_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
"ViT_B_32_Weights",
"ViT_L_16_Weights",
"ViT_L_32_Weights",
"ViT_H_14_Weights",
"vit_b_16",
"vit_b_32",
"vit_l_16",
"vit_l_32",
"vit_h_14",
]


Expand Down Expand Up @@ -105,11 +103,6 @@ class ViT_L_32_Weights(WeightsEnum):
default = ImageNet1K_V1


class ViT_H_14_Weights(WeightsEnum):
# Weights are not available yet.
pass


def _vision_transformer(
patch_size: int,
num_layers: int,
Expand Down Expand Up @@ -203,19 +196,3 @@ def vit_l_32(*, weights: Optional[ViT_L_32_Weights] = None, progress: bool = Tru
progress=progress,
**kwargs,
)


@handle_legacy_interface(weights=("pretrained", None))
def vit_h_14(*, weights: Optional[ViT_H_14_Weights] = None, progress: bool = True, **kwargs: Any) -> VisionTransformer:
weights = ViT_H_14_Weights.verify(weights)

return _vision_transformer(
patch_size=14,
num_layers=32,
num_heads=16,
hidden_dim=1280,
mlp_dim=5120,
weights=weights,
progress=progress,
**kwargs,
)